diff --git a/eslint-suppressions.json b/eslint-suppressions.json index ee6e1a1ba31..a6386359869 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -669,7 +669,7 @@ }, "packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.story.tsx": { "no-restricted-syntax": { - "count": 3 + "count": 2 } }, "packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts": { diff --git a/packages/grafana-ui/src/components/InteractiveTable/Expander/index.tsx b/packages/grafana-ui/src/components/InteractiveTable/Expander/index.tsx index 346d18b38fb..4aa0d0f634f 100644 --- a/packages/grafana-ui/src/components/InteractiveTable/Expander/index.tsx +++ b/packages/grafana-ui/src/components/InteractiveTable/Expander/index.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import { CellProps, HeaderProps } from 'react-table'; -import { t } from '@grafana/i18n'; +import { t, Trans } from '@grafana/i18n'; import { IconButton } from '../../IconButton/IconButton'; @@ -16,8 +16,9 @@ export function ExpanderCell({ row, __rowID }: CellProps ({ row, __rowID }: CellProps + Row expander + + ); +} + export function ExpanderHeader({ isAllRowsExpanded, toggleAllRowsExpanded }: HeaderProps) { return (
diff --git a/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.story.tsx b/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.story.tsx index c8cf16cf2b6..e0df9d9782f 100644 --- a/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.story.tsx +++ b/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.story.tsx @@ -112,8 +112,6 @@ const meta: Meta> = { controls: { exclude: EXCLUDED_PROPS, }, - // TODO fix a11y issue in story and remove this - a11y: { test: 'off' }, }, args: { columns: [ diff --git a/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.tsx b/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.tsx index a046f24b89c..d5a25e2e480 100644 --- a/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.tsx +++ b/packages/grafana-ui/src/components/InteractiveTable/InteractiveTable.tsx @@ -14,6 +14,7 @@ import { } from 'react-table'; import { GrafanaTheme2, IconName, isTruthy } from '@grafana/data'; +import { t } from '@grafana/i18n'; import { useStyles2 } from '../../themes/ThemeContext'; import { Icon } from '../Icon/Icon'; @@ -345,7 +346,7 @@ const getColumnHeaderStyles = (theme: GrafanaTheme2) => ({ }); function ColumnHeader({ - column: { canSort, render, isSorted, isSortedDesc, getSortByToggleProps }, + column: { canSort, render, isSorted, isSortedDesc, getSortByToggleProps, Header, id }, headerTooltip, }: { column: HeaderGroup; @@ -376,7 +377,13 @@ function ColumnHeader({ if (canSort) { return ( - ); diff --git a/packages/grafana-ui/src/components/InteractiveTable/utils.ts b/packages/grafana-ui/src/components/InteractiveTable/utils.ts index 68017bbfd19..2b664b16f6d 100644 --- a/packages/grafana-ui/src/components/InteractiveTable/utils.ts +++ b/packages/grafana-ui/src/components/InteractiveTable/utils.ts @@ -1,6 +1,6 @@ import { Column as RTColumn } from 'react-table'; -import { ExpanderCell, ExpanderHeader } from './Expander'; +import { EmptyExpanderHeader, ExpanderCell, ExpanderHeader } from './Expander'; import { Column } from './types'; export const EXPANDER_CELL_ID = '__expander' as const; @@ -18,9 +18,7 @@ export function getColumns( { id: EXPANDER_CELL_ID, Cell: ExpanderCell, - ...(showExpandAll && { - Header: ExpanderHeader, - }), + Header: showExpandAll ? ExpanderHeader : EmptyExpanderHeader, disableSortBy: true, width: 0, }, diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 90c8f67b1bf..d6ecdd24882 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -9024,6 +9024,8 @@ "interactive-table": { "aria-label-collapse-all": "Collapse all rows", "aria-label-expand-all": "Expand all rows", + "aria-label-sort-column": "Sort column {{columnName}}", + "expand-row-header": "Row expander", "expand-row-tooltip": "Toggle row expanded", "tooltip-collapse-all": "Collapse all rows", "tooltip-expand-all": "Expand all rows"