Repository navigation
Draw the options' picks, Add, Done and the margin's rows without positioned boxes - #5375
Merged
Merged
Conversation
…tioned boxes Chromium's hit test visits every positioned box and stacking context on the page, whatever point it tests: `PaintLayer::HitTestLayer` checks no layer's bounds before descending into its children. Each `elementsFromPoint`, `caretPositionFromPoint` and hover test paid for every box Leaf positioned. On the 512-section asks page of `leaf-dev scaling` that was 21 boxes per question, 10,781 in all, and a wheel step made about three such tests. Each box below now takes its place from the layout around it, and is positioned only while something it holds needs a containing block: - A card's pick is the float that reserves its corner slot, replacing the `::before` that reserved it, with margins that stand it where its insets did. The card is positioned only while its digit badge holds a key. - Add stands at the end corner of the field's own grid cell, over the words in document order, and the add cell is positioned only while its badge or the field's error shows. The disc behind every symbol that wears one now shares the symbol's grid cell with its glyph, drawn first, so the glyph needs no `z-index`. A text field is no longer positioned as a scroll surface: its closed tree lays out in one grid cell and holds nothing out of flow. - Done's row drops its `position`, which gave Done's digit a containing block that Done's button already was. The button is positioned only while the digit shows. - Done keeps the floor as its face, so its reach, which would only repeat its own box, goes. Under a mouse Add's face meets the floor too and its reach goes; under a finger the floor is taller than Add's face, so Add keeps its reach and is positioned as the reach's containing block. Every other reach stays, a mark's and an inline action's among them (surfaces.css). - The margin's rows stand in one grid cell of their lane or carrier, offset by margins from the seat margin-layout.js writes, aligned to the cell's left since the seat is physical, so a right-to-left page keeps its rows. A row's face holds its glyph, unread dot and count in one grid cell, the dot and count standing in its corner by alignment, and is positioned only while its label stands. A label is drawn only while its face reveals, holds or has placed it, which is when margin-layout.js measures it. Checked against main on the 64-section page in ten states: at rest, a card hovered, a pick hovered, an ask's digits shown by `m`, an option chosen, words in Add, Add hovered, Add focused by Tab, Done hovered, and a pin's label shown. Every box and text line in three sections and their margin rows stands where it did. Screenshots in light and dark differ by at most 6 of 255 in a few antialiased pixels, apart from the text caret's blink. On a phone, the points that reach Add, swept every 2px over a band 44px past it, are main's; Done's are main's but for 5 of 4,275 at its rounded corners, which main's square reach covered. On a right-to-left page every margin row stands where main stands it. On pages of 256 answered threads, with rows pinned over the page or standing in the rail, every row, face and count stands where it did, and screenshots match main's pixel for pixel, at rest and with a row's label shown. Against main 7a2b11a, median of 5 rounds interleaved, a fresh tab each. A hit test is the mean of each round's fastest 20 ms batch; a wheel step is a `leaf-dev scaling` step (the page's height / 30, pointer at 400, 400), main-thread time from a trace: | | main | this | |---|---|---| | 64 sections: `elementsFromPoint` | 0.091 ms | 0.006 ms | | 64 sections: `caretPositionFromPoint` | 0.066 ms | 0.005 ms | | 64 sections: wheel step / its hit tests | 8.9 / 0.92 ms | 8.1 / 0.13 ms | | 512 sections: `elementsFromPoint` | 1.010 ms | 0.026 ms | | 512 sections: `caretPositionFromPoint` | 0.674 ms | 0.019 ms | | 512 sections: wheel step / its hit tests | 37.2 / 7.66 ms | 24.9 / 0.48 ms | On the page of 256 answered threads (64 rows, each with an unread dot and a count; 3 rounds), the layer-making boxes go from 432 to 100, `elementsFromPoint` from 0.033 to 0.011 ms, and a wheel step's hit tests from 0.52 to 0.22 ms. A group of bare options, laid out as rows, keeps its absolute Add and its own pick placement, unmeasured here: the scaling page's questions are titled cards. Three browser tests fail on main 7a2b11a as on this branch: `test_an_inline_contribution_name_needs_no_physical_margin` (both modes), `test_an_acknowledgment_uses_status_until_an_active_claim_restores_a_disclosure` and the scaled case of `test_a_short_window_keeps_media_choices_and_send_around_the_scrolling_draft`. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 4, 2026
This was referenced Nov 5, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 5, 2026
Under a finger a comment's pin draws 44px across, its face as large as the aim floor (#1164), and it stands over the words beside it. The candidate was to draw it at 26px, as under a mouse, inside a 44px aim given by a reach, as Leaf's buttons have, and to build it only if that stayed simple. It doesn't, so this PR changes no behaviour: it adds a `TODO(#4041)` at the pin's size rule (`--margin-entry` in `annotation-theme.css`) saying what the change needs. ## Why it isn't simple The seat search in `margin-placement.js` reads one box per pin. The smaller face needs two: the face, kept off words and touching its target, and the aim, kept off controls and other rows. CSS can give a pin one box or the other, and each choice breaks one of those. - **Row as the aim.** The attempt gave the face 9px margins, so the row's box was the 44px aim and every seat stayed as on `main`, plus a `::before` reach positioned only under a finger, so mouse pages keep the unpositioned faces #5375 gave them. That came to 26 added and 6 removed lines of CSS, comments included. But a pin seated outside its target (above, below or beside it) now draws its face 9px further from it. At phone width `leaf-dev pins --base` flagged 18 more of its 26 cases as `far` (more than 12px from the target), 20 in all against 2 on `main`, and `test_each_pin_case_seats_its_pins_by_their_targets_clear_of_what_they_hide[phone]` would fail on them. - **Row as the face.** Seating the 26px face lets the 44px aim lie over a neighbouring row or button and take its press, on 9 of 270 sentences in the earlier measurement. Doing it properly means passing the reach through `seatsBy`, `seatRow`, `pinSpot`, `leastCovering`, `slid` and `packRow`, and through the fold widths in `margin-layout.js`, with runtime tests for each. That is new geometry code in Leaf, which the bar for "simple" excluded. I haven't built it. ## What the CSS-only attempt measured - `leaf-dev probe --viewport phone --base` on a three-paragraph fixture, in Chromium and Firefox: every row kept its seat (49×44 at the same coordinates), the face drew 26×26 centred in it, and presses 18px left, right, above and below the face's centre landed on the pin. - A sweep of 13 examples at 390×844 under touch, with a comment on every sentence (up to 25 a page, all at once), read in Chromium: of 176 sentences with a pin on both arms, the face covered a word on 68 on `main` and 41 with the attempt. 27 got better and none got worse, and no row moved. Because the seat search still avoided words with the 44px box, this falls short of the earlier measurement's 4%, which seated the 26px face. ## Not verified - The sweep in Firefox. The fixture probe showed the same seats and faces there. - A real phone. Part of #4041. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 5, 2026
Closed
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
…lick-opens-in-reply (#5543) Four `--run-main` tests have been red on main since #5375 and #5410. Each fails because the test still expects behavior one of those changes replaced, so this PR updates the four tests and leaves product code alone. All four fail on current main and pass on this branch: `uv run pytest --run-main` over the four node ids, 8 cases. - **#5375** made a titled card's pick the float that reserves its corner slot. Before, a `::before` reserved the slot and the pick was positioned with `z-index: 1`. - `test_a_quoted_widget_exhibits_without_taking_input` read the slot from `::before`, which no longer exists, so both cards read 0. It now measures the pick's float margin box: 0 on the exhibit, which has no mark, and >0 on the live card. - The pick is now unpositioned, so the binding badge positioned in the same seat paints over it and takes a press there. Playwright refuses to click the covered mark. `test_a_queue_row_names_an_answer_whose_widget_module_arrives_last` now presses the card. `lf-options.js` already takes a press on the card or on the badge as a pick. - `test_workspace_end_room_stays_inside_the_last_reading_region` clicked the mark and then walked with ArrowDown and Space. A press on the badge leaves focus on the ask, as a press on the card's words already did, so the test now focuses the mark before the walk. - **#5410** made a click on a margin marker open the thread in its reply (`openingPart` in `thread/focus.js`). `test_the_margin_groups_meanings_at_one_destination_without_moving_the_page` still expected the reply to be unfocused after a marker click, a case #5410 didn't update. The test now expects it focused. **Behavior changed:** a pointer press on a worn digit in a card's corner still picks, but it no longer focuses the mark. #5375 caused this change without stating it. This PR records it in the tests rather than undoing it. #5542 asks the maintainer whether that press should focus the mark. I tried giving the badge `pointer-events: none` so the press would reach the mark again. That hides the badges: `command-hints.js` seats a badge only when hit tests find it on top, and three binding tests in `test_render_options.py` failed. That approach is dropped. The margin test first failed at #5375 with a different assertion: `{'needed': 1163, 'rail': 119}`, in run 41876972397. That assertion passes on current main, so the only failure left was the reply focus. Closes #5485 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Chromium's hit test visits every positioned box and stacking context on the page, whatever point it tests:
PaintLayer::HitTestLayerchecks no layer's bounds before descending into its children. EachelementsFromPoint,caretPositionFromPointand hover test paid for every box Leaf positioned. On the 512-section asks page ofleaf-dev scalingthat was 21 boxes per question, 10,781 in all, and a wheel step made about three such tests. Each box below now takes its place from the layout around it, and is positioned only while something it holds needs a containing block:::beforethat reserved it, with margins that stand it where its insets did. The card is positioned only while its digit badge holds a key.z-index. A text field is no longer positioned as a scroll surface: its closed tree lays out in one grid cell and holds nothing out of flow.position, which gave Done's digit a containing block that Done's button already was. The button is positioned only while the digit shows.Checked against main on the 64-section page in ten states: at rest, a card hovered, a pick hovered, an ask's digits shown by
m, an option chosen, words in Add, Add hovered, Add focused by Tab, Done hovered, and a pin's label shown. Every box and text line in three sections and their margin rows stands where it did. Screenshots in light and dark differ by at most 6 of 255 in a few antialiased pixels, apart from the text caret's blink. On a phone, the points that reach Add, swept every 2px over a band 44px past it, are main's; Done's are main's but for 5 of 4,275 at its rounded corners, which main's square reach covered. On a right-to-left page every margin row stands where main stands it. On pages of 256 answered threads, with rows pinned over the page or standing in the rail, every row, face and count stands where it did, and screenshots match main's pixel for pixel, at rest and with a row's label shown.Against main 7a2b11a, median of 5 rounds interleaved, a fresh tab each. A hit test is the mean of each round's fastest 20 ms batch; a wheel step is a
leaf-dev scalingstep (the page's height / 30, pointer at 400, 400), main-thread time from a trace:elementsFromPointcaretPositionFromPointelementsFromPointcaretPositionFromPointOn the page of 256 answered threads (64 rows, each with an unread dot and a count; 3 rounds), the layer-making boxes go from 432 to 100,
elementsFromPointfrom 0.033 to 0.011 ms, and a wheel step's hit tests from 0.52 to 0.22 ms.A group of bare options, laid out as rows, keeps its absolute Add and its own pick placement, unmeasured here: the scaling page's questions are titled cards.
One difference a page can author: a card's title that the author positions (
position: relative) with a background now paints over the pick's slot, since positioned content paints after a float; main's pick was positioned withz-index: 1and stood over it. Leaf makes a card's title block-level and nothing bundled positions one, so the pick stays unpositioned rather than costing a layer in every card.Three browser tests fail on main 7a2b11a as on this branch:
test_an_inline_contribution_name_needs_no_physical_margin(both modes),test_an_acknowledgment_uses_status_until_an_active_claim_restores_a_disclosureand the scaled case oftest_a_short_window_keeps_media_choices_and_send_around_the_scrolling_draft.