Skip to content

Reach, open and move between clickable Table rows from the keyboard and screen readers - #244

Merged
Shrinks99 merged 5 commits into
mainfrom
grd-565-equality-table-reach-open-and-move-between-clickable
Nov 26, 2026
Merged

Shrinks99 merged 5 commits into
mainfrom
grd-565-equality-table-reach-open-and-move-between-clickable

Conversation

@Shrinks99

@Shrinks99 Shrinks99 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Fixes GRD-565. Goes along with eqtylab/guardian#836.

What changed

  • TableRowAction (new) wraps the text that names a row in its cell. It becomes the row's link when the row has an href, or a button when it has only onClick, and it's stretched over the row, so the row stays one click target.
  • Keyboard: each TableBody is one Tab stop. Enter opens the row, and Up, Down, Home and End move between rows. The stop is the row's TableRowAction, else its link, else (a clickable row with only onClick) the row itself.
  • Routing and new tabs: with href and onClick, a plain click runs onClick instead of following the link, so navigate opens the row without a reload. Cmd, Ctrl, Shift and middle clicks open the URL in a new tab or window.
  • Controls in a row (buttons, links, menus, checkboxes, selects, text fields, labels, switches) keep their own keys and clicks and don't open the row.
  • Selection uses a Checkbox only, labelled by the name cell. data-state="selected" now highlights any body row, not only a clickable one.
  • clickable is only needed for an onClick row without a TableRowAction.

Why TableRowAction

I tested the options with VoiceOver in Safari and Chrome:

Approach Result
Focusable <tr> Safari never lands on it. Chrome reads its text with no role, so nothing says it opens.
<tr> + aria-describedby hint Safari skips the hint. Only Chrome reads it.
Existing href link (a direct child of the <tr>) Safari can't reach it, and hrefLabel repeats the row's name.
Link or button around the name, in its cell "Name, Alice Cooper, link", with Tab and with VoiceOver's cursor, in both browsers. Activating it runs onClick with no reload.
Checkbox in a cell "Alice Cooper, unchecked", then "checked".

Wrapping the name gives the row a role screen readers announce without adding a label. The link also appears in the screen reader's links list and opens with Enter in NVDA and JAWS browse mode; those two are standard link behaviour but weren't tested here.

Worth checking on upgrade

  • A row with both href and onClick no longer follows the link on a plain click. Guardian's followLinkInApp helper becomes unnecessary but stays harmless.
  • A row's href should be the URL the browser opens, including the router's basename (React Router's useHref). Guardian's row hrefs are router paths, so a Cmd-click under a base path would open the wrong URL.
  • Rows with href and no TableRowAction are now one tab stop per body instead of one per row.

🤖 Generated with Claude Code

Shrinks99 and others added 2 commits November 23, 2026 20:27
A TableRow with clickable and onClick now takes focus as a single tab
stop per TableBody, opens on Enter, and moves with Up, Down, Home and
End. Keys on controls inside the row stay with those controls, and
clicks inside a portal opened from the row no longer trigger it.

Fixes GRD-565

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-reach-open-and-move-between-clickable

# Conflicts:
#	packages/demo/src/content/docs/components/table.mdx
#	packages/ui/CHANGELOG.md
@Shrinks99
Shrinks99 requested a review from tmccoy14 November 24, 2026 02:18

@tmccoy14 tmccoy14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this. The roving tab stop is done carefully: portal clicks and key presses are filtered with currentTarget.contains, the tab stop falls back to the first row when the active row is removed, and the consumer's onKeyDown, onFocus, tabIndex and refs are all passed through. The tests cover every main case in the ticket. Fixing the bug where a menu item click also triggered the row is a good catch.

I left a few inline comments. Two are about what screen reader users get from a focused row, and one is about the click filter against what the docs now promise. There's also one question from the ticket still open: Cmd/Ctrl-click to open in a new tab. Could we record a decision on that, even if it's "not supported, use href"?

Smaller optional items:

  • focusableRows includes rows hidden with display:none or hidden. focus() does nothing on them, so ArrowDown can get stuck before a hidden row, and a hidden row can become the active row, which makes Tab skip the table.
  • A consumer passing tabIndex={-1} still gets data-table-row-focusable, so that row can become the active row and Tab skips the table.
  • Holding Enter repeats click(). An if (e.repeat) return; would stop repeated navigate calls or selection flipping back and forth.
  • Each row first renders with tabIndex=-1 and renders again once its ref callback sets state. It's harmless because the layout effect fixes it before paint, but it's one extra render per row.
  • Rows outside a TableBody all get tabIndex=0. That's a reasonable fallback, but a test or a docs line would make it intentional.
  • Docs: "a single stop" is really one stop per TableBody. The Usage example uses AgentActionsMenu, which is a Guardian name, and an inline DropdownMenu would be clearer.
  • Since this replaces the hand-rolled "make the name cell a link" workaround, consider adding a row to the name translation table in packages/skills/equality-design-system/SKILL.md, as CLAUDE.md asks.
  • Tests could also cover modifier keys being ignored, and a consumer onKeyDown that calls preventDefault() stopping the row's handling.

Generated by Claude Code

VoiceOver never announces a focused table row as something that opens,
and can't reach a link placed directly in a <tr> in Safari. TableRowAction
wraps the row's name in a link (with href) or button (with onClick only),
stretched over the row, so it is announced in place without an extra
label and becomes the row's keyboard stop.

A row with href and onClick now runs onClick on a plain click and leaves
modified clicks to the browser, so routers open rows without a reload
and Cmd/Ctrl-click opens a new tab. Clicks on form controls inside a row
no longer open it. Selection uses a checkbox only, and a selected row
highlights whether or not it is clickable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Shrinks99 Shrinks99 changed the title Reach, open and move between clickable Table rows from the keyboard Reach, open and move between clickable Table rows from the keyboard and screen readers Nov 24, 2026
@Shrinks99

Shrinks99 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member Author

This took a while! Tested with voiceover (both myself and Claude) and had to add an extra prop to make this work. Our tables should now offer much better keyboard navigation and improved auditory cues for non-visual users.

Going to skip most of the optional suggestions here unless you object? Seems like overbuilding.

@Shrinks99
Shrinks99 requested a review from tmccoy14 November 24, 2026 22:10

@tmccoy14 tmccoy14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough VoiceOver testing. The comparison table in the description makes the case for TableRowAction clearly.

All four earlier threads are addressed: a focused row is now announced as a link or button, the click filter covers form controls and menu items (with tests), modified clicks are left to the browser when the row has href with onClick, and selection goes through a labelled Checkbox. The docs fixes look good too. I'm fine skipping the remaining optional items.

One optional nit: the CSS that lifts controls above the row overlay (table-components.module.css:139-146) is shorter than ROW_CONTROLS in the TSX. It leaves out [role=menuitem] and [contenteditable], so a contenteditable in a linked row would sit under the overlay and open the row when clicked. Making the two lists match would close that.

Before merging: the branch now conflicts with main in packages/ui/CHANGELOG.md after 6.2.0, so CI hasn't run on the last two commits. Locally on c146bd1, lint, format check, typecheck, build and all 315 UI tests pass.

Also worth noting: the AGENTS.md change narrows when the translation table gets a row, which applies to the whole repo and not just this component.


Generated by Claude Code

@matthewmr-eqty matthewmr-eqty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this. I had Claude run it locally against 7.0.0 with the keyboard: rows open and move as described, and row heights, the cell pull and focus rings are unchanged. Approving. I'll fold the changelog into 7.1.0 when #256 goes in.

@Shrinks99

Copy link
Copy Markdown
Member Author

Checked, Looks like it's good to merge from me!

@Shrinks99
Shrinks99 merged commit c8237b9 into main Nov 26, 2026
1 check passed
@Shrinks99
Shrinks99 deleted the grd-565-equality-table-reach-open-and-move-between-clickable branch November 26, 2026 21:26
matthewmr-eqty added a commit that referenced this pull request Nov 26, 2026
Need: teams waiting on keyboard-reachable table rows should see them in the 7.1.0 notes.
Problem: #244 landed under Unreleased, apart from the release it ships in.
Solution: its entries join the matching 7.1.0 lists after the release's own, and the Unreleased heading is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
matthewmr-eqty added a commit that referenced this pull request Nov 27, 2026
Need: product pages need a page title that leads without shouting, and dialogs need a title of their own.
Problem: text-title was 30, and Dialog, Sheet and AlertDialog each set their own 18 title off the text styles.
Solution: five text styles on the size steps, title-2 for dialogs, cn exported on tailwind-merge 3, and #244's keyboard-reachable table rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants