Skip to content

Keep a let-go in the pane the user reads, and name Threads and its cards - #1897

Merged
max-sixty merged 12 commits into
mainfrom
workspace-keyboard-a11y
Oct 6, 2026
Merged

max-sixty merged 12 commits into
mainfrom
workspace-keyboard-a11y

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Pressing Escape in a workspace pane, or closing a surface opened over one, now keeps the user in the page region they were reading. Before, they ended up at the workspace header: d and u stopped moving the pane, and the next Tab started at the top. The Threads panel and the thread cards on the page now have accessible names. These are the fixes from the TODO #14 audit, which followed one task through a workspace by keyboard and checked the accessibility tree.

The audit

I used annotation-workspace because it has every part the brief lists: a header with a nav landmark, a bounded pane, an aside holding the annotation rail, and a footer. rust-sort covered a pane long enough to scroll. Both ran at 1440×900, 1024×768 and 700×900, through leaf-dev probe --journey. The route:

  • read with ?, Tab, j/d
  • search with /, then c to comment on the match
  • send, then Escape
  • open Threads with g T and Tab through it
  • Escape out
  • resize from 1440 to 700 and back

At each step the probe recorded the focused element, its name and role, whether it had a ring and was on screen, and the ARIA snapshot.

Fixed

  • A let-go left the pane the user was reading. Escape, closing a panel and g p all land on readingBlock(). With no argument, it read the page outside every bounded region, and in a workspace whose panes scroll themselves that is only the header. In rust-sort, Escape on a link in the Source pane left d moving nothing, and Tab started again in the other pane. reading-regions.js now remembers the page region the user last acted in (pageReadingRegion) separately from the most recent region of any kind. A surface's own region, such as the Threads list, no longer replaces it. Landings and walk origins (pageReadingBlock, landingPlace) read the visible block in that region; if the region shows none, they read the region that contains it, and so on out to the page. A pane on screen that shows no text block (a figure, a spacer) gets its body as the landing, so the region survives there too. Now Escape in the Source pane leaves d paging it (449 → 898), and Tab continues inside it. The a walk's starting point and version continuity's fallback region follow the same page region.
  • The Threads list stayed the reading-key region after the panel closed. After a pointer close, d scrolled the hidden list: on review-a-plan the page stayed at 0, and it now scrolls to 474. Likewise, g p from an open beside panel used to land at the top of the document; now it lands on the paragraph in view. A region hidden from layout no longer answers, and the user is back in their page region. A pane scrolled out of view still answers, so d continues through a workspace body that carries flowing panes.
  • The Threads panel was an unnamed dialog. Its title now names it. registerAuxiliarySurface refuses a surface with no accessible name, so a new panel or drawer can't ship without one. The Queue and Leaves drawers already had names.
  • Thread cards on the page had no name. These are the cards in the rail and the margin. After a send in the rail, focus lands on the card, and a screen reader announced it as an unnamed group. Every card outside the panel is now named "Thread, ". Panel cards take their name from the summary row, which is where focus lands in the panel.

Checked, no defect

  • Landmarks: main, the "Review regions" nav, the "Sampling evidence" region, the "Conversations and actions" complementary, and the banner.
  • Every Tab stop shows its focus ring. Option marks ring their whole row.
  • Banner, rail, option and composer controls all have names a reader can follow.
  • Covering posture (700px): the page is inert, the panel has aria-modal, Tab wraps inside the panel, the first Escape returns to the thread list, and the second returns to the page.
  • Posture change from 1440 to 700 and back keeps the focused control and each pane's scroll position.
  • Give merge film steps keyboard activation #1888 changed only wt-merge, its corpus entry and its test, so it doesn't overlap.

Decided, follow-up: focus under a panel that stands beside the page

When the panel stands beside the page (a window wide enough to leave a usable page), it still sits over part of it. In a workspace that fills the window, that part holds live controls:

  • At 1440×900, Tab walks onto annotation-workspace's rail controls, which are under Threads.
  • c on a selection opens the rail's comment box under Threads too.
  • The Queue panel sits over an Ask's option marks at 1200px.

Closing the surface whenever focus lands on content it hides fixed all three, but closed the Queue partway through answering it, so I reverted it and asked. Max's answer: the panels dominate focus. Moving focus never closes or changes a standing panel; instead focus never lands on page content a panel covers, and Threads still stands beside a full-width workspace. This change leaves that behaviour as it is on main; the TODO.md item records the rule, and a follow-up PR implements it.

Pane focus (deferred TODO item)

"Show which pane has focus, and move between panes by key" stays deferred. On a fresh workspace j/d move nothing until the user enters a pane, because no pane has been acted in yet. That doesn't stop a task, since Tab reaches every pane's controls.

Underlying fix

Yes. The let-go defect came from the one place every landing reads, not from letGo. reading-regions.js kept a single "recent region" slot that the page's panes and the chrome's surfaces shared. Leaf's own fallback focus on the body also counted as the user choosing the page. The first version of this change fixed only readingBlock's default. An independent review then ran three more routes through the same slot:

  • g p from a beside Threads panel
  • the a walk's starting point with focus in the Threads list
  • a pane with no text block in view

All three failed. A fourth route, pane → g T → Escape, failed on main too, and so did a fifth: a let-go after the remembered pane scrolled out of a scrolling workspace body. The page's region now lives in its own slot, and readings step outward from it. All five are covered by tests.

The unnamed dialog shipped because the axe sweep runs only WCAG-tagged rules, and aria-dialog-name is tagged best practice. The registration check now refuses an unnamed auxiliary surface, so none can ship that way.

I read git log -L on readingBlock and userReadingRegion: #1811 added the assertion that Escape forgets the pane, recording the behaviour this PR changes.

Tests

  • test_a_click_on_a_panes_words_makes_it_the_subject_of_every_scroll_key: the region now survives Escape and u scrolls the pane. This replaces Keep a pane's reading region through a click on its words #1811's assertion that the region is gone.
  • test_a_let_go_keeps_the_user_in_the_pane_they_read: new. It covers pane → g T → Escape, a let-go in a pane with no text block in view, d through a workspace body carrying flowing panes, and a g p landing once that pane has scrolled away.
  • test_a_closed_threads_panel_hands_the_page_back_where_the_user_was_reading: new. It covers g p from a beside panel and d after a pointer close.
  • test_the_thread_panel_and_a_page_thread_carry_names: new.
  • Each new assertion fails on main, on the first version of this change, or under a targeted mutation of the line it protects.
  • npm run test:runtime passes.
  • A selection of browser tests passes, filtered to let-go, walk, panel, drawer, region, pane, card, queue and version cases across navigation, anchors, projection, controls, read-state, threads, margin, send-placement and widgets.

This was written by Claude Code on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The PR body leaves the beside-panel focus behavior open for Max to decide. That choice determines whether Tab can leave focus on covered page controls, and whether the Queue stays open when Tab reaches an Ask's option mark. I’m withholding approval until that behavior is settled.

max-sixty added a commit that referenced this pull request Oct 6, 2026
…r it (#1903)

At 390px a side-list queue (`lf-tabs list="side"`) wrapped its list into
rows above the open item. On a 20-item queue the list ran 629px and the
first item started 770px down, below the fold. The theme already
described the narrow list as "a row over" the item, but only the page's
own strip was held to one row; every other strip wrapped.

### What changes

- **Every tab strip is one row**
(`skills/leaf/packages/default/theme.css`). A strip's names scroll
sideways when they outrun it, under the edge presses the page strip
already had. On the 20-item queue the list is one 70px row and the item
starts 71px below the queue's top. A side list's column at desktop width
still runs down.
- **The edge presses follow the marks.** They show wherever the layer
marks more names that way (`data-lf-more-before`, `data-lf-more-after`),
not only on the page strip. They stick at the strip's edge rather than
inside its inline padding (`--lf-tabstrip-pad`), and their fade uses the
strip's own background.
- **The open tab stays in the row** (`lf-tabs.js`). A walk, Home/End, or
a press brings it in, including onto the tab already open, so Home is a
way back after a swipe. So does any change to the strip's size: a
narrower window, a panel opening beside the page, or a side list's
column turning into a row.
- **A narrow queue's first paint keeps its row.** A row's summary is a
line of a stated height (`--lf-tab-summary-h`), and the reserved strip
includes it where any row has a summary.
- **The reserved margins sit under `:where`**, as the upgraded set's do,
so a set at its frame's edge loses its margin at first paint too.

### Behavior that changed for the user

- A framed tab set with more names than fit scrolls them sideways rather
than wrapping them onto more rows.
- A tab set first in `main` no longer jumps 24px up when it upgrades.
- A side list's desktop rows are 1–2px shorter: the summary is now a
17px line with no 2px foot.
- In a right-to-left page, ArrowLeft walks to the next tab and
ArrowRight to the previous one, as the ARIA tabs pattern asks. Review
found this while walking an RTL strip.

### Is there a more underlying fix?

**Yes**, in two rounds.

The first version of this branch fixed only the side list's narrow row.
The queue was one case of a wider defect. The first paint keeps one row
for every strip (`--lf-tabstrip-h`), every strip except the page's
wrapped, and #1484 listed "names that wrap the strip onto a second row"
as not reserved. A framed set with 20 tabs at 390px wrapped onto five
rows and moved its panel 184px at startup. The fix makes one row a
property of every strip and deletes the page strip's private copies of
the scrolling and press rules, along with the "names that wrap"
exception. The new first-paint case `tab-names-outrunning-a-phone`
failed on the first version and passes now. Running it also exposed the
24px first-paint margin above.

Review then ran the other routes to a strip that runs past its row, and
three rules held only for the page strip, which never changes from a
column and has no inline padding. The open tab came into view only when
a tab opened. The presses sat 8px inside a padded strip. A row made from
a column had no presses at all. The first two are fixed here, and each
failed when run: taking out the size watch, the press inset, or the
press on the open tab fails
`test_a_tab_strip_keeps_its_open_tab_in_its_one_row`.

The third is general rather than a tab-strip case. `reach.js` reads
which boxes declare a scroll only when it sweeps them, so any box that a
narrower window or a container turns into a scroller gets no stop or
continuation marks. A plain `div` with `@media (width < 600px) {
overflow-x: auto }`, loaded wide and narrowed, shows it. Re-running the
sweep from lf-tabs would repeat reach's rule in one caller, and #1902 is
changing `reach.js`'s `classify`. So this PR records the defect as a
strict xfail
(`test_a_box_that_starts_scrolling_at_a_narrower_window_takes_a_stop`)
and leaves the fix to `reach.js`. Until then, a queue narrowed from a
desktop width shows no edge presses until reload. Swiping and the
keyboard walk still reach every tab.

### Evidence

- `test_a_side_list_is_a_queue_beside_the_item_it_opens` checks that the
phone list is one row that runs past. It fails against the old theme.
- `test_a_tab_strip_keeps_its_open_tab_in_its_one_row` is new (above).
- `test_a_widget_first_paints_the_box_it_presents` gains a framed set
and a queue at 390px. Both failed before this change.
- `uv run pytest` over the render, gate, widget-quality, pages, threads,
anchors and chrome-contract files, selecting tab, strip, queue, side,
first-paint, widget, reach and scroll cases, passes. `npm run
test:runtime` passes.
- `leaf-dev stills` (new state `alert-queue-touch`): the alert queue at
390px goes from a 14-row block before the first alert to one scrolling
row over it. The other changed states are on pages without a tab set and
differ by caret or timestamp pixels between runs.

### Not in this PR

- "Let a queue group its items" stays in TODO.md. No convention in the
registry or references settles its markup form, so it went to Max as a
question.
- Narrowing the window on `alert-review` switches the queue from the
open alert back to the first one, on main as well. Version continuity's
resize restore reveals a reading recorded before the switch, because
lf-tabs brackets a switch with `preserveReadingRegions` only in page
flow. #1897 is changing that continuity code, so this went to the
coordinator.
- `reach.js` re-reading which boxes scroll after a width change (above).

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit db9ac2d into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the workspace-keyboard-a11y branch October 6, 2026 16:14
max-sixty added a commit that referenced this pull request Oct 6, 2026
…#1927)

With Threads open beside `annotation-workspace`, `c` on a selection used
to open the comment box in the annotation rail under the panel, so the
user typed into a box they could barely see. Now the box opens in the
panel's foot, and returns to the rail when the panel closes. This is the
part of Max's rule from the #1897 audit ("the panels should dominate
whatever focus changes we have, focus should not be able to affect
panels") that the repo already settles.

## How

- `geometry.js` gains `underOccluder(where)`: whether any standing panel
or drawer `hides` it, which is the measure travel already uses.
- `seatFab` (composing/surface.js) refuses a seat a panel stands over,
so the box stays at its home. Without the overlay, that home is the
Threads panel's foot; with it, the box floats beside the selection. The
check reads the seat, not the editor moved into it, because an outlet
that hasn't rendered the editor yet measures it as zero width. A boxless
outlet is judged by the element that lays out its contents.
- Whenever a surface opens, closes or arrives, or its edge or the window
moves, the page is presented again while a comment box stands
(`reachChanged` → `invalidateDom`, at most once a frame), so the box
moves to whichever seat it can now use. Dragging the Threads edge over
an inline diff comment on `pr-walkthrough` now moves the box clear of
the panel with its words.

## Left for Max: Tab under a panel beside the page

Tab still walks onto the rail's controls under Threads at 1440×900, and
onto an Ask's option marks under the Queue panel at 1200px. I first made
everything a panel covers by more than half its width `inert`. That kept
Tab off it, but an independent review found two problems:

- The visible part of a partly covered element went dead to clicks, text
selection and find. On `corpus` at 1100px with Threads open, 145 such
elements still showed beside the panel.
- Focus still reached chrome margin markers, sample frames, children
overflowing their parent, and content revealed by an attribute.

I withdrew it. TODO.md records the decision this needs:

- **A. Lay the page out in the width the panel leaves beside it.**
Nothing live stands under a panel, and the whole class of cases goes. It
costs a reflow when a panel opens or closes, and it reverses "auxiliary
surfaces never change the page's geometry" in
`skills/leaf/assets/AGENTS.md`.
- **B. Leaf owns Tab beside a panel**, skipping the stops `hides` says
it covers. The overlay stays, but Leaf takes over sequential order from
the browser, including stops inside shadow trees.

## Tests


`test_a_comment_box_opens_where_a_panel_beside_the_page_leaves_it_in_sight`
is new. It covers the rail under Threads, the box's return when the
panel closes, and a slow edge drag. It fails on main, and it fails when
the seat check or the re-seat is removed, or when the re-seat runs only
on open and close.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants