Skip to content

Say a margin marker's place and distance down only while focus is on it - #6095

Merged
max-sixty merged 3 commits into
mainfrom
marker-focus-names
Nov 16, 2026
Merged

max-sixty merged 3 commits into
mainfrom
marker-focus-names

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Each margin marker's accessible name said its place among the markers and how far down the page its target stands ("Thread, 3 of 17, 40 percent down, …"), so any marker joining or leaving, and any change in the page's height, read every target's box and renamed every marker, a cost that grew with the page (#6078 noted it at markerName). Now a marker says what it holds and its subject at rest, and says where it stands only while it holds focus: focus coming to or leaving a marker names it once the script ends, and the margin's layout pass names the focused marker again, since every change to where a marker stands comes with a pass. A render names only the markers it drew.

What to weigh: this changes what a screen reader hears. A listener landing on a marker by any route (Tab into the rail, the walk's arrows, Page Map, a dialog handing focus back) hears its place and distance as before; one reading the margin in browse mode without moving focus hears each marker's subject without them. Max picked this over keeping every name whole from the layout pass's positions, which would have saved the reads but still renamed every marker. The distance now reads the target and the column as the window draws them, which also fixes it doubling under a zoom on the column (50 percent read as 100, on main too, found by a Codex review).

leaf-dev bench asks --input open --input comment --sizes 64,256,1024 --rounds 2 --base at 1,024 sections, on a loaded Mac: sending a comment 191.9 → 170.9 ms of main-thread CPU; opening a comment box loses the 42 ms of forced style the names' skipped checks made.

Tests: the Page Map walk, row-leaving and pointed-row tests now check the focused marker's name and that no marker says where it stands at rest or once focus leaves; switching off each rule fails one of them. Runtime tests and the focused margin browser tests pass.

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

max-sixty and others added 2 commits November 15, 2026 19:56
Each margin marker's accessible name said its place among the markers and how far
down the column its target stands ("Thread, 3 of 17, 40 percent down, ..."). Both
change for every marker whenever a marker joins or leaves or the page's height
changes, so each such change read every target's box, forced style on each target
to ask whether it was skipped, and renamed every marker (`readSpokenPositions`,
`nameMarkers`), at a cost that grew with the page (#6078 noted it at `markerName`).

A marker now carries what it holds and its subject at rest, and says where it stands
only while it holds focus, which is when a listener hears it. Focus coming to or
leaving a marker names it once the script ends (`afterScript`), so focus passing
through a marker on its way elsewhere, as a closing dialog hands focus to its opener,
writes nothing. After each margin layout pass the focused marker is named again,
since every change to where a marker stands comes with one: a row joining, leaving or
taking another place asks for a pass, as does a change in the page's size. A render
names only the markers it drew. A screen reader reading the margin without moving
focus hears each marker's subject without its place: the maintainer's choice over
keeping every name whole from the positions the layout pass already reads, which
would have saved the reads but still renamed every marker on each change.

The distance down now reads the target and the column as the window draws them,
rather than the target's drawn top against the column's unscaled `scrollHeight`, so
a zoom on the column no longer doubles it (50 percent down read as 100 under `zoom:
2` on `main`, on main and before this change). It no longer asks `proseRect`, which
read every child of the column. `lf-margin-layout` no longer carries the column's
box, which only the names read.

`leaf-dev bench asks --input open --input comment --sizes 64,256,1024 --rounds 2
--base` at 1,024 sections, load average 20 to 30: sending a comment took 170.9 ms of
main-thread CPU against 191.9; opening a comment box spent 59 ms in forced style
recalculation against 101, the 42 ms of `skipped` checks the names made gone, and
265 ms of script in the resize callback against 294.

Tests: the Page Map walk test walks the markers and checks each focused one says
where it stands, and that none says so at rest or once focus leaves; the row-leaving
test checks the focused marker's count once the margin has laid out after a row
leaves; the pointed-row test checks the focused marker's distance after the page
grows below it. Switching off each rule (every marker named with its place, the
rename on blur, the rename after a layout pass) fails one of them.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 0174075 into main Nov 16, 2026
4 checks passed
@max-sixty
max-sixty deleted the marker-focus-names branch November 16, 2026 04:46
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