Repository navigation
fix(session-ui): stop hiding a working turn from screen readers - #66120
Conversation
Both timelines marked every reply and tool row of a working turn aria-hidden. Those rows hold controls the reader can see and use, a tool header or a link in a reply, so Tab stopped on controls that a screen reader does not read. The attribute is a leftover. Until #13196 a turn hid its steps while it worked and announced the finished reply through a screen-reader-only live region. #13196 removed that region and kept the hiding. No live region wraps the rows, so nothing reads a reply again while it streams, with or without the attribute. Tests: "every Tab stop of a working turn can be seen and read" in session-timeline-accessibility.spec.ts, for both timelines. mobile-timeline-scroll.spec.ts now takes the timeline's own scroll region: a shell tool's output in a working turn is a region of the same name, and role queries find it now.
There was a problem hiding this comment.
The fix works. On the base, the new e2e test fails in both timelines: the shell tool header and the reply link take Tab focus but are inside aria-hidden="true". With this change, session-timeline-accessibility.spec.ts (8/8) and mobile-timeline-scroll.spec.ts (37/37, touch-scroll project) pass. bun run typecheck in packages/session-ui stopped at Script not found "check"; typecheck:tsc passes. Nothing else reads the removed attribute.
The public API is unchanged: this only touches session-ui rendering and e2e specs.
The new test is larger than the fix needs (see the inline comment). #51084, an open outside PR, makes the same change for the same issue.
| // A working turn shows controls the reader can use, such as a tool header and a link in a reply. The keyboard stops | ||
| // on each one where the reader can see it, and none is hidden from a screen reader. | ||
| for (const newTimeline of [false, true]) { | ||
| test(`every Tab stop of a working turn can be seen and read (${newTimeline ? "New" : "current"} timeline)`, async ({ |
There was a problem hiding this comment.
This test is large for a one-attribute fix. It presses Tab and Shift+Tab up to 20 times, reads document.activeElement and its geometry through page.evaluate, and pins the exact stop order (["a", "button", "button"]). That order includes the user message's menu, which this change doesn't touch, so the test can break when unrelated row layout changes.
The fixed behaviour is that the controls of a working turn are in the accessibility tree. Role queries already skip aria-hidden subtrees, so a few lines would do. For example, with the turn still working, assert that getByRole("link", { name: "the notes" }) and the tool header found with getByRole("button", …) are visible, and maybe that the link takes focus. Could you cut it down to that?
The Tab walk no longer pins the order of its stops, which held the user message's menu. It checks that no stop is hidden or out of view, and that the walk passed the turn's tool header and its link. "uses grouped background shell presentation" asked for hidden elements to reach the tool group's header of a working turn. It asks by role alone now, so it guards the fix as well.
There was a problem hiding this comment.
The new commit passes on the head and fails on the base as expected: I ran the updated Tab-walk test (both timelines) and the timeline-stream grouped-shell test both ways. Dropping includeHidden: true is correct now that the header is in the accessibility tree.
The Tab-walk test no longer pins the exact stop order, which removes the coupling to unrelated rows. It still keeps the full Tab/Shift+Tab walk, so the earlier thread on its size stays open.
The public API is unchanged. Nothing new to raise.
|
Thanks for picking this up, Luke. I've updated #51084 against I've linked this PR from mine so the overlap is easy to track. |
Fixes #54652
What was wrong
aria-hidden.aria-hiddenmust not hold a control that takes focus.flowchart LR subgraph before["dev: a turn works"] a["rows marked aria-hidden"] --> b["Tab stops on a tool header"] a --> c["screen reader is given nothing"] end subgraph after["this change: a turn works"] d["rows not marked"] --> e["Tab stops on a tool header"] d --> f["screen reader reads the same control"] endWhy the attribute was there
The change
In
packages/session-ui/src/timeline/session-timeline-row.tsxandpackages/session-ui/src/timeline-next/row.tsx:aria-busyon rows still being written was considered and left out: it is not certain that every screen reader keeps such a region readable.Before and after
A long real session, with its last turn put to work by a synthetic stream. Counts are of the rows and controls on screen.
dev, currentdev, Newaria-hiddenfocus()calls that scroll the timelineWhat is announced does not change:
devrole="status", "Working")Not in this change
Failing on the base
Three app component tests fail on
origin/devon my machine, with this change and without it. This change does not touch what they test:components-lab.spec.ts: "opens a component from the standalone catalog and previews its states"panel-sidebar-side.spec.ts: "Review: the Sidebar position submenu moves the file tree right and back"panel-sidebar-side.spec.ts: "Open file: the Sidebar position submenu moves the file tree right and back"Tests
e2e/regression/session-timeline-accessibility.spec.ts: "every Tab stop of a working turn can be seen and read", for the current and the New timeline. It walks Tab and Shift+Tab through a working turn and fails ondev, where the tool header and the link are insidearia-hidden.e2e/regression/timeline-stream.spec.ts: "uses grouped background shell presentation" reached the tool group's header of a working turn by asking for hidden elements (includeHidden: true). It asks by role alone now, so it fails ondevtoo.e2e/regression/mobile-timeline-scroll.spec.tsfound the timeline by a role query for a region named "scrollable content". A shell tool's output is a region of the same name, and in a working turn the query now finds it too. The file takes the region that holds timeline rows.Added by the opencode bot (AI-generated).
Fixes #54652
Related: #51084