Skip to content

bug(ui): SegmentedControl's radios move focus on arrow keys without checking #4069

Closed

Description

@yannickmonney

Summary

SegmentedControl (@tale/ui) exposes its options as a role="radiogroup" of role="radio" buttons, but the arrow keys only move focus: the checked option stays put until Space or Enter. For a radio group, the WAI-ARIA pattern (and what screen-reader users expect from "radio button, 2 of 3") is that arrow keys move focus and check.

The new pages filter in the website dialog (#4065) has the same problem. Its manual box KNOW-F36 expects "the arrow keys switch them". The phone Home view switcher, a radio group in the same app, does switch on arrows, and #3746 settled the same expectation for the shared filter radios.

Source and environment

  • Source: origin/main at 62df44379 (2026-10-02), in a detached worktree with no local changes.
  • Stack: an isolated local stack started with bun scripts/dev.ts. Vite runs on localhost:3621, the backend on 127.0.0.1:3626, and the occurrence has its own PostgreSQL cluster on 127.0.0.1:55362.
  • Browser: headless Chromium 1208 (playwright-core 1.58.2) at 1280×900, en-US.
  • Data: a synthetic website with failed and skipped pages (see the TALE-358 08:15 receipt), so the filter All · Failed (26) · Skipped (3) shows.

Reproduction

  1. Open Knowledge › Websites, open the site, and focus All in the pages filter ("Which pages to show").
  2. Press ArrowRight, then Space, then ArrowLeft, then Enter, checking which option is checked and what the list shows after each key.

Observed

The markup is radiogroup "Which pages to show" containing button role=radio aria-checked × 3, with roving tabindex.

Key Focus Checked List
(start) All All indexed pages
ArrowRight Failed (26) All (unchanged) indexed pages (unchanged)
Space Failed (26) Failed (26) failed pages
ArrowLeft All Failed (26) (unchanged) failed pages
Enter All All indexed pages

Expected

ArrowRight and ArrowLeft move focus and check the option, so the list switches as KNOW-F36 says. That is the radio-group contract and how the Home view switcher behaves:

Alternatively, drop the radio roles in favour of a toggle-button group (aria-pressed). Then arrow keys moving focus only is the documented pattern, and the box would need updating.

Root cause

packages/ui/src/components/forms/segmented-control.tsx:71–96: the control is a Radix ToggleGroup (type="single"). Radix renders it with radio semantics but keeps roving focus separate from activation, which is the toggle-group behaviour, and SegmentedControl adds no selection-follows-focus handling.

There are two callers: the website view dialog's pages filter and website-create-dialog.tsx.

Acceptance checks

  • In SegmentedControl, ArrowRight, ArrowLeft, Home and End move focus and check, and the group stays a single Tab stop. Alternatively the roles change to a toggle group and KNOW-F36 is updated.
  • In the website pages filter, ArrowRight from All shows the failed pages (KNOW-F36).
  • A packages/ui test drives the arrows and asserts aria-checked and onValueChange.

Retained evidence

Evidence is retained locally under /agent/workspace/.tale358/r20261002T0815/, and attached as a tarball to Tale task TALE-358:

  • evidence/w3-keyboard.log (the roles and the key-by-key table);
  • evidence/w2-pages-filter-B.log (the two ArrowRight presses that left All checked);
  • scripts/w3-keyboard.ts.

Limits

  • No screen reader was run; the roles and states come from the DOM.
  • The create dialog's use of the control wasn't driven.
  • Local stack only.

Activity

  1. yannickmonney commented on Oct 4, 2026

    @yannickmonney
    ContributorAuthor

    Post-merge recheck of #4163 against this issue's original key-by-key reproduction: fixed, on both callers. Run by the reporter, agent #3 (TALE-358 local-qa run 1f452e6a-3035-4cc9-a49b-d23d867a05ac), on origin/main 403a9a537.

    Setup: a fresh local stack and Chromium 1208 at 1280×900. This is the replay of w3-keyboard.ts from r20261002T0815.

    The website pages filter ("Which pages to show"), on a site whose offline crawl failed (All · Failed (1) · Skipped (0)):

    Key Before the fix: checked Now: focus → checked List
    ArrowRight from All All (unchanged) Failed (1) → Failed (1) the failed page
    Space Failed Failed (1) → Failed (1) same
    ArrowLeft Failed (unchanged) All → All same
    Enter All All → All same
    End — Skipped (0) → Skipped (0) empty
    Home — All → All the failed page

    Add website › Source type (Whole website | URL list):

    • ArrowRight checks URL list, and the form switches to the URL-list input.
    • ArrowLeft, End and Home follow focus the same way. Space and Enter keep the value.
    • Tab leaves the group, and Shift+Tab returns to the checked option without changing the value. It stays one tab stop.
    • A mouse click still checks.

    Evidence is in TALE-358's r20261004T0415 deliverables: scripts/x2-segmented-arrows-recheck.ts, evidence/x2-segmented-arrows-recheck.log and evidence/x2/*.png.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions