From 853e47d078af1ba76301e69fd1e2bc28dfd61d07 Mon Sep 17 00:00:00 2001 From: Jonathan Sabutis Date: Wed, 18 Nov 2026 12:48:17 -0800 Subject: [PATCH] fix: give sortable Table starter column headers a button role The Table starters wrap the column name in a Group with role="presentation" and tabIndex={-1} so it can take focus apart from the ColumnResizer. A focusable presentational element is announced with no role, so a screen reader user has no cue that activating it changes the sort order. Render a plain div instead, with role="button" when the column allows sorting and no role otherwise. Group only supplied the focus ring state, so the focus ring now uses :focus-visible. Closes #8502 --- starters/docs/src/Table.css | 2 +- starters/docs/src/Table.tsx | 5 ++--- starters/tailwind/src/Table.tsx | 11 ++++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/starters/docs/src/Table.css b/starters/docs/src/Table.css index f85af8be007..d37916fcc94 100644 --- a/starters/docs/src/Table.css +++ b/starters/docs/src/Table.css @@ -207,7 +207,7 @@ border-color: transparent; border-radius: var(--radius-sm); - &[data-focus-visible] { + &:focus-visible { outline: 2px solid var(--focus-ring-color); outline-offset: 2px; } diff --git a/starters/docs/src/Table.tsx b/starters/docs/src/Table.tsx index fa4c60ca315..9629931f96a 100644 --- a/starters/docs/src/Table.tsx +++ b/starters/docs/src/Table.tsx @@ -21,7 +21,6 @@ import { TableFooter as AriaTableFooter, type TableFooterProps } from 'react-aria-components/Table'; -import {Group} from 'react-aria-components/Group'; import {composeRenderProps} from 'react-aria-components/composeRenderProps'; import {Checkbox} from './Checkbox'; import {ProgressCircle} from './ProgressCircle'; @@ -41,9 +40,9 @@ export function Column(props: Omit & {children?: React. {({allowsSorting, sortDirection}) => (
- +
{props.children} - +
{allowsSorting && (