Skip to content

fix(session-ui): stop hiding a working turn from screen readers - #66120

Merged
Hona merged 2 commits into
devfrom
working-turn-readable
Nov 24, 2026
Merged

Hona merged 2 commits into
devfrom
working-turn-readable

Conversation

@Hona

@Hona Hona commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Fixes #54652

What was wrong

  • Both timelines mark every reply and tool row of a working turn aria-hidden.
  • Those rows hold controls the reader can see and use: a tool header, a link in a reply.
  • Tab stops on them, and a screen reader reads nothing there. A region marked aria-hidden must 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"]
  end
Loading

Why the attribute was there

<div data-slot="session-turn-collapsible-content-inner" aria-hidden={working()}>{/* steps */}</div>
<div class="sr-only" aria-live="polite">{!working() && response() ? response() : ""}</div>
  • feat(app): session timeline/turn rework #13196 removed the live region and kept the hiding, around replies and tools alike. Its description is empty.
  • No live region wraps the rows. So nothing reads a reply again while it streams, with the attribute or without it.

The change

In packages/session-ui/src/timeline/session-timeline-row.tsx and packages/session-ui/src/timeline-next/row.tsx:

-<div data-slot="session-turn-assistant-content" aria-hidden={phase(current().userMessageID).live}>
+<div data-slot="session-turn-assistant-content">
  • Nothing takes its place. aria-busy on rows still being written was considered and left out: it is not certain that every screen reader keeps such a region readable.
  • No CSS and no other code read the attribute.

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, current This change, current dev, New This change, New
Reply and tool rows marked aria-hidden 5 of 5 0 of 5 6 of 6 0 of 6
Controls inside them 2 of 4 0 of 4 3 of 4 0 of 4
Streamed words in the accessibility snapshot no yes no yes
Live regions around the timeline or a reply none none none none
focus() calls that scroll the timeline 0 0 0 0

What is announced does not change:

dev This change
A reply as it streams nothing nothing
The status line (role="status", "Working") announced announced
A finished reply nothing nothing

Not in this change

  • Since feat(app): session timeline/turn rework #13196 nothing announces a finished reply. That is a gap of its own.
  • Read from Chromium's accessibility tree and with role queries. Not checked with a screen reader.
  • No feature flag: this is a fix.

Failing on the base

Three app component tests fail on origin/dev on 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 on dev, where the tool header and the link are inside aria-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 on dev too.
  • e2e/regression/mobile-timeline-scroll.spec.ts found 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

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.

@opencodejr opencodejr Bot 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.

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.

Fixes #54652
Related: #57512, #51084

// 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 ({

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.

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.

@opencodejr opencodejr Bot 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.

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.

@aimansour

Copy link
Copy Markdown
Contributor

Thanks for picking this up, Luke. I've updated #51084 against dev and extended the fix and regression coverage to both the current and New timelines. Streamed assistant text and tool controls are now accessible during generation in both renderers, and all 108 Playwright tests in the affected suites passed.

I've linked this PR from mine so the overlap is easy to track.

@Hona
Hona merged commit 58473c4 into dev Nov 24, 2026
14 checks passed
@Hona
Hona deleted the working-turn-readable branch November 24, 2026 23:28
@amrkmn amrkmn mentioned this pull request Nov 26, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants