Skip to content

Commit

Permalink
Merge pull request #2860 from TheSharpieOne/fix/table-toolbar-aria-label
Browse files Browse the repository at this point in the history
fix(tabletoolbar): provide aria-label to CarbonTableToolbar
  • Loading branch information
kodiakhq[bot] authored Sep 23, 2021
2 parents 625d8c7 + a43ffb5 commit 5bd56a1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react/src/components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export const defaultProps = (baseProps) => ({
itemSelected: (selectedCount) => `${selectedCount} item selected`,
rowCountInHeader: (totalRowCount) => `Results: ${totalRowCount}`,
toggleAggregations: 'Toggle aggregations',
toolbarLabelAria: undefined,
/** empty state */
emptyMessage: 'There is no data',
emptyMessageBody: '',
Expand Down Expand Up @@ -727,6 +728,7 @@ const Table = (props) => {
downloadIconDescription: i18n.downloadIconDescription,
rowCountInHeader: i18n.rowCountInHeader,
toggleAggregations: i18n.toggleAggregations,
toolbarLabelAria: i18n.toolbarLabelAria,
}}
actions={{
...pick(
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Table/TablePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export const I18NPropTypes = PropTypes.shape({
closeMenuAria: PropTypes.string,
clearSelectionAria: PropTypes.string,
batchCancel: PropTypes.string,
toolbarLabelAria: PropTypes.string,
/** String 'items selected' or function receiving the selectedCount as param:
* (selectedCount) => `${selectedCount} items selected` */
itemsSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const propTypes = {
filterAscending: PropTypes.string,
filterDescending: PropTypes.string,
toggleAggregations: PropTypes.string,
toolbarLabelAria: PropTypes.string,
}),
/**
* Action callbacks to update tableState
Expand Down Expand Up @@ -215,6 +216,7 @@ const TableToolbar = ({
// TODO: remove deprecated 'testID' in v3
data-testid={testID || testId}
className={classnames(`${iotPrefix}--table-toolbar`, className)}
aria-label={i18n.toolbarLabelAria}
>
<TableBatchActions
// TODO: remove deprecated 'testID' in v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ Map {
"selectRowAria": "Select row",
"tableErrorStateTitle": "Unable to load the page",
"toggleAggregations": "Toggle aggregations",
"toolbarLabelAria": undefined,
},
"id": null,
"lightweight": false,
Expand Down Expand Up @@ -1121,6 +1122,9 @@ Map {
"toggleAggregations": Object {
"type": "string",
},
"toolbarLabelAria": Object {
"type": "string",
},
},
],
"type": "shape",
Expand Down Expand Up @@ -2156,6 +2160,9 @@ Map {
"toggleAggregations": Object {
"type": "string",
},
"toolbarLabelAria": Object {
"type": "string",
},
},
],
"type": "shape",
Expand Down Expand Up @@ -3768,6 +3775,9 @@ Map {
"toggleAggregations": Object {
"type": "string",
},
"toolbarLabelAria": Object {
"type": "string",
},
},
],
"type": "shape",
Expand Down

0 comments on commit 5bd56a1

Please sign in to comment.