Repository navigation
Keep a pane's reading region through a click on its words - #1811
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The Python gate failed in test_first_unread_opens_the_exact_message_and_exposure_acknowledges_it: the page had drawn the message as read, but the test indexed the read log before that bookkeeping POST completed. The test needs to wait for the click's own send and response before asserting on the durable log. I verified that ordering change in a focused local run and will push it to this branch.
2418c42 to
b479806
Compare
|
The read-event test now passes on |
…rds (#1897) 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, <topic>". 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. - #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 #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_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
A click on words inside a pane now keeps that pane as the reading region for the next scroll key. In the failed main run,
ddid not move the right pane after the reader clicked its text. The click records the pane onpointerdown, then Chrome sendsfocusinonbodybeforepointerup; that second event cleared the recorded region. The reading-region owner now lets the press's pointer event retain its decision through that incidental body focus.The pane-click browser test failed before this change and passes after it. It now asserts the selected region after the click and that Escape returns to the page. The focused-pane keyboard case also passes. Other failures from the full Python job remain tracked in #1592.
Refs #1592