You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by so...@apache.org on 2023/12/23 06:28:49 UTC
(superset) branch master updated: fix(accessibility): Enable tabbing on sort header of table chart (#26326)
This is an automated email from the ASF dual-hosted git repository.
sophieyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new b6d433de32 fix(accessibility): Enable tabbing on sort header of table chart (#26326)
b6d433de32 is described below
commit b6d433de32cad21c0866ee98fd5ae85b4459c23b
Author: arun <ar...@gmail.com>
AuthorDate: Sat Dec 23 11:58:41 2023 +0530
fix(accessibility): Enable tabbing on sort header of table chart (#26326)
---
.../plugins/plugin-chart-table/src/TableChart.tsx | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
index 917abb929a..d106e42a84 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
@@ -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 && {