diff options
author | 2021-08-03 16:25:25 +0000 | |
---|---|---|
committer | 2021-08-03 16:25:25 +0000 | |
commit | c51fd5692565983658c1daa12ecae6adebc257d5 (patch) | |
tree | 0172f94532605c0ec68d3f9d4e755e420d7e41ae /sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx | |
parent | 53cb85faef848051ca1264b30e9a279f56b04631 (diff) | |
parent | 96d32fbfa1c0dcda85db3d06edaff36267023cfa (diff) |
Merge "Add aria-labels to odlux tables"
Diffstat (limited to 'sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx')
-rw-r--r-- | sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx b/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx index f7de0a062..4ad6422dc 100644 --- a/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx +++ b/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx @@ -67,7 +67,7 @@ interface ITableToolbarComponentProps extends WithStyles<typeof styles> { numSelected: number | null; title?: string; tableId?: string; - customActionButtons?: { icon: React.ComponentType<SvgIconProps>, tooltip?: string, onClick: () => void, disabled?: boolean }[]; + customActionButtons?: { icon: React.ComponentType<SvgIconProps>, tooltip?: string, ariaLabel: string, onClick: () => void, disabled?: boolean }[]; onToggleFilter: () => void; onExportToCsv: () => void; } @@ -91,7 +91,7 @@ class TableToolbarComponent extends React.Component<ITableToolbarComponentProps, render() { const { numSelected, classes } = this.props; const open = !!this.state.anchorEl; - const buttonPrefix = this.props.tableId !== undefined ? this.props.tableId + '-' : ''; + const buttonPrefix = this.props.tableId !== undefined ? this.props.tableId : 'table'; return ( <Toolbar className={`${classes.root} ${numSelected && numSelected > 0 ? classes.highlight : ''} `} > <div className={classes.title}> @@ -110,7 +110,7 @@ class TableToolbarComponent extends React.Component<ITableToolbarComponentProps, {this.props.customActionButtons ? this.props.customActionButtons.map((action, ind) => ( <Tooltip key={`custom-action-${ind}`} title={action.tooltip || ''}> - <IconButton disabled={action.disabled} aria-label={buttonPrefix + `custom-action-${ind}`} onClick={() => action.onClick()}> + <IconButton disabled={action.disabled} aria-label={`${buttonPrefix}-${action.ariaLabel}-button`} onClick={() => action.onClick()}> <action.icon /> </IconButton> </Tooltip> @@ -118,20 +118,20 @@ class TableToolbarComponent extends React.Component<ITableToolbarComponentProps, : null} {numSelected && numSelected > 0 ? ( <Tooltip title="Delete"> - <IconButton aria-label={buttonPrefix + "delete"}> + <IconButton aria-label={`${buttonPrefix}-delete-button`}> <DeleteIcon /> </IconButton> </Tooltip> ) : ( <Tooltip title="Filter list"> - <IconButton aria-label={buttonPrefix + "filter-list"} onClick={() => { this.props.onToggleFilter && this.props.onToggleFilter() }}> + <IconButton aria-label={`${buttonPrefix}-filter-list-button`} onClick={() => { this.props.onToggleFilter && this.props.onToggleFilter() }}> <FilterListIcon /> </IconButton> </Tooltip> )} <Tooltip title="Actions"> <IconButton color="inherit" - aria-label={buttonPrefix +"additional-actions-button"} + aria-label={`${buttonPrefix}-additional-actions-button`} aria-owns={open ? 'menu-appbar' : undefined} aria-haspopup="true" onClick={this.handleMenu} > |