mirror of
https://github.com/apache/superset.git
synced 2024-09-07 06:17:45 -04:00
fix(accessibility): Enable tabbing on sort header of table chart (#26326)
This commit is contained in:
parent
3391e29093
commit
b6d433de32
@ -71,6 +71,12 @@ interface TableSize {
|
||||
height: number;
|
||||
}
|
||||
|
||||
const ACTION_KEYS = {
|
||||
enter: 'Enter',
|
||||
spacebar: 'Spacebar',
|
||||
space: ' ',
|
||||
};
|
||||
|
||||
/**
|
||||
* Return sortType based on data type
|
||||
*/
|
||||
@ -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 && {
|
||||
|
Loading…
Reference in New Issue
Block a user