Skip to content

fix(ui): give filter radios one Tab stop and the arrow keys - #3853

Merged
yannickmonney merged 6 commits into
mainfrom
fix/filter-panel-radio-keyboard
Sep 29, 2026
Merged

yannickmonney merged 6 commits into
mainfrom
fix/filter-panel-radio-keyboard

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

The shared FilterPanel's single-choice facets are now a real radio group. From the keyboard there is one Tab stop per group, the arrow keys move the focus and the choice together, and Tab leaves the group. The panel also opens with the focus inside it, so a keyboard alone can reach the facets at all.

What was wrong

  • Bug: shared filter radios ignore arrow keys and expose every option as a tab stop #3746: a single-choice facet was a row of plain <button role="radio">. Every option was its own Tab stop (tabIndex=0 on all five priorities), and ArrowDown did nothing.
  • Found while reproducing on current main, not reported elsewhere (I searched open and closed issues): opening Filter with Enter left the focus on the button, because onOpenAutoFocus was prevented. The next Tab moved to the next page control (Create task on the board), and the non-modal popover closed on that focus move. A keyboard-only reader never reached any facet. It is the same shared component and the same keyboard contract, so it is fixed here too.

What changed (packages/ui/src/components/filters/filter-panel.tsx)

  • The radio group. The single-choice branch uses @radix-ui/react-radio-group, the primitive the shared RadioGroup is built on:
    • one Tab stop, on the chosen option or else the first;
    • Tab into a group does not choose anything;
    • the arrow keys move and choose, and wrap;
    • Tab and Shift+Tab leave the group;
    • Radix manages aria-checked.
      The full-row look stays, with the shared focus ring added (focus-visible:ring-ring ring-2). Each grouped segment keeps its own labelled radiogroup, as CONV-A4 documents.
  • The existing way to clear stays. A click or Space on the chosen option still restores defaultValues ?? []: an optional facet clears, and a mandatory one (a metrics period) goes back to its default. Radix's own click on an option that an arrow key lands on is not read as such a press. What changes is Enter, which no longer chooses: Radix follows the WAI-ARIA radio pattern there.
  • The keys that move the focus move the choice with it: arrows, Home, End, PageUp and PageDown. While sweeping consumers in the real app, a quick second ArrowDown on Settings → Metrics → Projects → Period moved the focus to Last 7 days but left Last 90 days checked.
    • Cause: Radix checks an option only if the arrow key is still down when its deferred focus lands, and never for Home or End. A page busy with the last choice (URL update, refetch) lets the key come up first.
    • Fix: in those cases the panel chooses the option the focus lands on. It decides the focus came from a key by the focus event's relatedTarget, and it mirrors Radix's key state, so exactly one of the two chooses. Radix's roving tab stop is untouched.
  • Opening puts the focus on the first facet's header, not on Clear all, which a reflexive Enter would fire. The call uses preventScroll. Escape still closes the panel and returns focus to Filter, and Tab loops inside the non-modal panel.

Consumers swept

The fix is in the one shared component, so every single-choice facet gets it. On main those are:

  • tasks board Assignee and Priority (and its skeleton);
  • inbox Read and Channel;
  • metrics Period, Granularity and Metric;
  • audit-log Category and activity Period;
  • guardrails Source and Kind;
  • legal-hold Target, Status and Release history;
  • contacts Source and Locale, products Status, websites Status and Interval;
  • useListPage managed filters.

Multi-choice facets (checkboxes) are unchanged.

How it was verified

  • Unit (jsdom), filter-panel.test.tsx, 8 new cases:
    • opening lands on the first facet header, not Clear all;
    • one Tab stop, held arrow keys move and choose, exactly one onChange per key, tabIndex roving, Tab and Shift+Tab;
    • a quick key press, released before the focus moves, still chooses;
    • Home and End choose;
    • an arrow key landing on the chosen option leaves it chosen;
    • a Tab entry chooses nothing, even after a key that moved nothing, and Shift+Tab leaves the group for its header;
    • Space or a click on the chosen option clears;
    • a mandatory facet goes back to its default.
      6 of the 8 fail on main's component; the other two are behaviour-preservation controls. The quick-press case also fails on a pure-Radix version of this change, as do the Home/End and landing cases on the first head of this PR. All 28 cases in the file pass.
  • Real Chromium, filter-panel.browser.test.tsx, 1 new case with CDP key presses: Tab to Filter, Enter, the focus is on the Priority header, Enter, Tab, the focus ring shows, held arrows, Space clears, Tab and Shift+Tab, Escape. Two more arrow presses run on a page kept busy by a 150 ms task queued ahead of Radix's deferred focus; there the key comes up first, and the choice must still follow.
    • It fails on main. The busy-page part fails on a pure-Radix version (the focus reaches Medium, the choice stays on High).
    • All 5 browser cases pass.
  • Consumers:
    • packages/ui data-table, catalog, metrics and useListPage tests: 19 files, 206 tests pass;
    • data-table-toolbar and target-size browser tests pass;
    • 24 platform consumer test files pass: tasks workspace and skeleton, inbox, home inbox, audit logs, activity log, connectors, providers, DSAR, guardrails, legal holds, contacts, products, websites, documents, projects, credentials, competences, trash, skills and metrics pages. providers-settings.test.tsx timed out twice in the batch while the shared machine was saturated, and passed 28/28 alone.
    • the ai-gateway accounts-screen test passes.
  • Real UI. Local stack: own Postgres, backend/main.ts, vite preview of the production build; loopback only, synthetic organizations. Keyboard only on the task board with four fixture tasks:
    • The final runs used a production build of c1e46d6b0. The maintainer's later merge of main (9d2bbe9c0) leaves every file these runs exercise byte-identical (git diff --quiet).
    • main: Enter opens, and the next Tab lands on Create task with the panel closed. With pointer entry, every radio has tabIndex=0 and ArrowDown does not move.
    • this branch: Enter puts the focus on Assignee inside the panel. Tab into the group lands on You, unchecked. ArrowDown chooses Unassigned and the board shows only the unassigned task; ArrowDown again chooses the owner. Tab goes to Priority, then ArrowDown chooses High, Space clears it, Escape returns to Filter. The other options stay at tabIndex=-1 throughout.
    • The same path on Settings → Metrics → Projects (the mandatory Period) chooses with each arrow press after the fix.
  • Review: a read-only adversarial review of the first head found one medium defect: an arrow key landing on the chosen option cleared it, after Home or End had moved the focus without choosing. Its low items were a stale key marker, a Chromium quick press that never reached the fallback, the ring clipped at the list's scroll edge, and doc wording. All are fixed in 379c6a0. Main was merged in afterwards.
  • Checks: oxlint --type-aware --type-check and oxfmt on the changed files, bun run lint:manual, and check-guide.ts on the accessibility and conversations suites (no new findings against origin/main) all pass. The docs locale and structure checks and the ui-docs content tests pass.

Docs and manual

  • services/ui-docs/content/components/data-table.md describes the panel's keyboard path.
  • docs/{en,de,fr}/platform/projects/tasks.md explains how to filter the board with the keyboard.
  • New cross-cutting box A11Y-A19 in suites/accessibility.md (Cost 27), with readme.md's totals recounted to 982 (fix(platform): keep cleared and typed values in task history #3813 adds one tasks box too, so whichever lands second counts 983): the board's Assignee and Priority with Clear all showing, then the mandatory metrics Period.
  • CONV-A4 loses its "fully keyboard-operable" claim for the precise contract.
  • A reference/automation.md row for the component half.

Scope

Closes #3746

A single-choice facet in the shared FilterPanel was a row of plain buttons
with role="radio": every option was a Tab stop, and the arrow keys did
nothing. Opening the panel from the keyboard also left the focus on
Filter, so the next Tab went on down the page and closed the panel before
the keyboard reached any facet.

The facet is now the Radix radio group the shared RadioGroup is built on.
It has one Tab stop (the chosen option, else the first), arrow keys that
move the focus and the choice together and wrap, and Tab and Shift+Tab
that leave it. Each option shows the focus ring. A click or Space on the
chosen option still sets the facet back to its resting selection, which
clears an optional one. Radix checks an option only while the arrow key is
still down when its deferred focus lands, which a page busy with the last
choice misses; the panel then chooses the option itself, never twice.

The panel opens with the focus on its first facet's header, not on Clear
all, so the keyboard reaches every option. The fix is in the one shared
component, so every consumer gets it: task board, inbox, metrics periods,
governance lists and data tables.

Closes #3746
Review follow-ups for the filter radios.

- An arrow key landing on the chosen option no longer clears it. Radix
  clicks the option an arrow key's focus lands on, and the panel read that
  click as a second press of the chosen option.
- Home and End (and PageUp and PageDown) move the choice with the focus,
  as the arrow keys do, so the focus and the choice never part.
- The panel decides that a key moved the focus by the focus event's own
  relatedTarget, so a key that moved nothing can never make a later Tab
  entry choose, and a quick second key cannot leave nobody choosing.
- The focus ring is inset, so the list's scroll edge never cuts it off.
- The Chromium test holds the main thread before Radix's deferred focus,
  as a busy page does, so the panel's own choosing is what it proves.
  New unit cases cover Home and End, an arrow onto the chosen option, a
  Tab entry after a key that moved nothing, and Shift+Tab out of a group.
- The docs say Space chooses the focused option. A11Y-A19 names its
  routes and keys, sets up Clear all, and says what a screen reader
  announces.
…o-keyboard

The manual readme keeps main's totals; its counts are recounted once after the open PRs land.
…o-keyboard

The task docs keep both new paragraphs in EN/DE/FR: main's search and failed-load paragraphs after the Filter sentence, then this branch's keyboard walk-through of the filter panel before the board's own keyboard steps.
yannickmonney added a commit that referenced this pull request Sep 29, 2026
…s-refresh-and-focus

The manual readme is recounted on the merged tree (995 boxes). This branch's A11Y-A19 collided with the A11Y-A19 that #3853 adds, so it becomes A11Y-A20 in the suite, pins.md and the automation register.
@yannickmonney
yannickmonney merged commit ff78db4 into main Sep 29, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the fix/filter-panel-radio-keyboard branch September 29, 2026 15:53
yannickmonney added a commit that referenced this pull request Sep 29, 2026
A11Y-A19 (#3853) and A11Y-A20 (#3895) each raised the header from 26 to 27 on their own branch; with both merged the suite holds 28 boxes.
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.

Bug: shared filter radios ignore arrow keys and expose every option as a tab stop

1 participant