Repository navigation
Say a margin marker's place and distance down only while focus is on it - #6095
Merged
Merged
Conversation
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]>
leaf-agent
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 --baseat 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'skippedchecks 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.