Repository navigation
Let surfaces.css decide which mark a ringed box shows, and give every box mark one writer - #7072
Merged
Merged
Conversation
…where it stands Four painters each kept their own copy of "an attribute on each box an element shows through, taken off the boxes it left": target-paint's marks (aim, trace, proxy), its location ring, the obligation view's `data-lf-obligation` stamp, and the annotation renderer's `data-lf-mark`/`data-lf-projected-mark`. They now share `keepsOnEach` (lib/keeps.js), beside `keepsOnOne`. The obligation view's stamp, which found the boxes to clear with a page-wide `querySelectorAll` on every repaint frame, is now written by `paintLocation` from the same box list as the ring. Three modules also answered "does the location ring stand on this box?" each its own way: target-paint by its stand-down rule, anchor-paint by a copy of the box list without that rule, and the margin by comparing the decision element alone. `locationRingOn` is now the one answer, read live as #4583 requires, and `locationStandsDown` is private to target-paint. No behaviour change is intended. The cases where the old copies disagreed with the ring (focus on a shown part of a boxless decision; a trace on one) already drew one ring through surfaces.css.
leaf-agent
previously approved these changes
Nov 24, 2026
…rigin marks onto keepsOnEach The margin trace (margin-projection.js) and the focus mark (anchor-paint.js) no longer give way to the location ring in code, so `locationRingOn` goes, and both painters lose their `currentLocationObligation` capability. surfaces.css already draws a ringed box's ring whole, in the accent, whatever trace or focus mark it also wears. The margin's check dates from #5045, when the trace was a chrome element of its own; the marks have since moved onto the boxes they mark. `leaf-dev probe --frames`, reading every marked box's computed outline, clip and border image after each frame, drew the same sequence of frames with and without the checks (base 3f5751a) on seven routes: `m` arrivals, Tab into a question and back, a pick on the question and undo, a pick from inside it, which takes the location away, and undo, Escape and `m` again, and a margin marker left and reached again. Head wore `data-lf-traced` and `data-lf-mark` on the ringed box in those routes, so the comparison exercised the deleted paths. tests/runtime/anchor-paint.test.mjs is deleted. It protected that the focus mark followed the obligation view's live reading rather than a stale `data-lf-obligation` stamp (#4583); anchor-paint no longer reads the decision at all. The user-override and reported origin marks (projection/presentation.js) move onto `keepsOnEach`, which now answers the elements it reached. `markOne` loses the mode it took for the decision stamp, which `paintLocation` writes through `keepsOnEach` once a repaint frame, as `markHere` did.
leaf-agent
previously approved these changes
Nov 24, 2026
`test_an_obligations_margin_marker_keeps_its_location_ring_whole` asserted that no box wears `data-lf-traced` while an obligation's marker holds focus. Since the margin no longer holds its trace off a ringed target, the question wears both, and surfaces.css draws the ring whole over it, the same pixels as before. The test keeps its checks of the rings drawn, which are what the user sees.
leaf-agent
approved these changes
Nov 24, 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.
Two homes now settle where the user is shown on a box:
locationStandsDown(target-paint.js) decides whether the location ring shows round the decision the user is in.surfaces.cssdecides which mark a box shows when several land on it. On a ringed box, it draws the ring whole in the accent, whatever trace or focus mark the box also wears.Two code checks used to settle the second question themselves. The margin's trace and anchor-paint's focus mark each held their mark off a ringed box, and each read the decision from the obligation view to do it. Both checks are gone, and so is the
currentLocationObligationcapability both painters took. The margin's check dates from #5045, when the trace was a chrome element of its own.Every attribute painted onto the boxes an element shows through now has one writer,
keepsOnEachinlib/keeps.js. That covers the aim, trace, proxy and location marks, thedata-lf-obligationstamp (which no longer clears itself with a page-wide query each frame), the annotation renderer's marks, and the user-override and reported origin marks.What changes on screen:
display: contentsand focus lands on one of its paragraphs, main drew the focus floor 3px out. Now that paragraph wears the focus mark 6px out, as any focused paragraph does. Main's copy of the ring's box list in anchor-paint skipped the stand-down rule.<details>and a thread's margin marker on it holds focus, main drew nothing on the page. Now the summary wears the margin's grey brackets. That is whatfaceOf(margin-projection.js) asks for whenever a closed box hides a thread's target, so the page shows which box holds the thread. Main's check held the trace off because the user's location was that question, though the question's ring stood on a box the disclosure hides. The marker's preview card stands above or below the marker depending on what ran before the Tab, on main as here: a journey that settles before the Tab put it above in 3 of 4 runs on main and 4 of 4 here, and one that tabs straight after load put it below in 4 of 4 on both. This change doesn't move it.Evidence:
leaf-dev probe --framesread each marked box's computed outline, clip and border image after every frame, with the checks (3f5751a) and without them. Seven routes drew identical frame sequences:marrivals;m;On those routes the ringed box wore
data-lf-tracedordata-lf-markwithout the checks, so the deleted paths ran.Size against main: production code +60/−118 lines, comments +39/−42. Tests −50, mostly
tests/runtime/anchor-paint.test.mjs, which guarded the focus mark against a stale stamp; anchor-paint no longer reads the stamp. Exports:keepsOnEachis added andlocationStandsDownis now private.Still hand-written: these keep their own add-and-remove loops:
holdWords: a placement and a draft add only the elements their words stand in, and the next paint that changes a mark lets go of the rest, as the header at anchor-paint.js says.keepsOnEachtakes the whole set, so each such add would read every element holding a comment's words, a cost that grows with the page.The rest diff a set that other code also reads, so moving them would hold that set twice:
thread/surfaces.js's outlets, which five other sites read;paintVisualStatesreads;focus.jspaintFocus, whose diff also drives itsmovedreading and writes shadowparttokens.Tests:
pnpm run test:runtime(1119),pnpm run check, and 43 named browser tests on the location ring, focus rings, margin entries and traces, comment marks and origin marks all pass.test_an_obligations_margin_marker_keeps_its_location_ring_wholeno longer asserts that no box wearsdata-lf-traced; its checks of the rings drawn stay. 17leaf-dev stillsstates are unchanged against main. Two showed 0 px style differences that went away on a rerun.