Skip to content

Commit

Permalink
fix(accessibility): Enable tabbing on sort header of table chart (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
arunthirumani committed Dec 23, 2023
1 parent 3391e29 commit b6d433d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ interface TableSize {
height: number;
}

const ACTION_KEYS = {
enter: 'Enter',
spacebar: 'Spacebar',
space: ' ',
};

/**
* Return sortType based on data type
*/
Expand Down Expand Up @@ -591,6 +597,13 @@ export default function TableChart<D extends DataRecord = DataRecord>(
...sharedStyle,
...style,
}}
tabIndex={0}
onKeyDown={(e: React.KeyboardEvent<HTMLElement>) => {
// programatically sort column on keypress
if (Object.values(ACTION_KEYS).includes(e.key)) {
col.toggleSortBy();
}
}}
onClick={onClick}
data-column-name={col.id}
{...(allowRearrangeColumns && {
Expand Down

0 comments on commit b6d433d

Please sign in to comment.