Repository navigation
Stand a thread card clear of its subject's mark, not on its line - #5853
Conversation
A thread card and the comment box before it stood COMMENT_GAP (8px) from the box of what they are about, but every mark on a region, such as the bracket round an element whose thread is open, the margin trace and the Alt aim, is drawn --focus-region-room (8px) outside that box. So the card's left border sat on the bracket's line beside an element, and its foot on the bracket's top line over one. This has held since #4732 moved region marks 6px out on 29 October. The placement now keeps `subjectGap` from its subject: the mark's room, then the same COMMENT_GAP it keeps from the window's edge, so the bracket and the card's edge have that gap between them. It holds whether or not a mark shows, so the card stays put as a mark comes and goes under the pointer. The new `place-clear` rule records it. tokens.css registers --focus-region-room as a length, so the placement reads the token's own value rather than repeating its formula. Behavior the tests now pin: a card beside its subject stands 16px from it; it needs 8px more room to stand beside before going under or over, and 8px more past a margin entry before keeping the entry clear; a card opening under or over makes 8px more room.
leaf-agent
left a comment
There was a problem hiding this comment.
The window posture now also stands back the subject gap, though it has no subject and nothing draws a mark round it. When clear is null, options makes a zero-height reference at the boundary's top edge, and mainAxis now offsets the card from it by subjectGap(). The card therefore sits 16px below the room's top instead of the 8px (COMMENT_GAP) that the PR, and the new comment on COMMENT_GAP, say a surface keeps from its room's edges. I checked this with the runtime harness: choose({clear: null, …}) then options(…) on a boundary at top 50 places the card at y = 58 on the base and y = 66 at this head. No test covers this case, so none moved. The inline suggestion keeps the old gap for the unanchored case.
The unanchored window posture has no subject and nothing draws a mark round it, but the previous commit stood it subjectGap (16px) below the room's top instead of COMMENT_GAP (8px). It keeps COMMENT_GAP again, and a runtime test pins it.
…elow its subject A card below its subject now starts 16px under it, not 8px, so in a 1000x600 window the grown draft hits the window's foot and its transcript gives up the 8px. At 608px the card grows downward as it did before, and then the long draft bounds it as before. Closes #5917
…5928) #5853 made a thread card stand clear of its subject by `subjectGap` (the mark's room, `--focus-region-room`, plus `COMMENT_GAP`) instead of `COMMENT_GAP` alone. As that PR said, a card beside its words now narrows by 8px and needs 8px more room before it gives up standing beside. Five tests were sized to the old gap and have failed on main since, four in every `ci` push run and one in the nightly tier: each passes at #5853's parent `7c2112135` and fails at `a298398f6`. This change keeps #5853's placement and gives each test back the room the new gap takes; no runtime code changes. - `test_a_card_s_head_stands_whole_beside_news[True]`: at 1400px the touch card no longer fits beside its words, so it went under, grew wider and kept its time whole. At 1408px it stands beside again, and the docstring names the new width. - `test_a_head_s_words_take_its_controls_room_while_they_hide`: at 1440px the card is now 336px, which cuts the queued receipt (118px of words in 111px). At 1456px the card is 344px again, the width the base drew at 1440px. A margin card grows 0.5px for each 1px of window, which is why this takes 16px. - `test_one_unchanged_rewrite_stands_open_in_a_thread_across_its_readers`: at 1400px the card no longer fits beside the Feed reader, so it stands over the Feed message and blocks its double-click (Playwright: "`.lf-msg-head` … intercepts pointer events"). That test checks that only one rewrite stays open at a time, not where the card stands, so it now opens at 1408px. - `test_a_source_replacement_preserves_the_focused_draft_and_its_original_anchor[whole-datum]`: the reopened card stands under the document 15px down. The old bound, `+ 10`, held only the old 8px gap. The bound now asks the overlay for `subjectGap()`, so the test follows the `place-clear` rule from its owner. - `tests/journeys/test_render_margin.py::test_a_second_margin_reply_grows_below_the_first_line` (nightly): the card under its subject now starts 8px lower, so in a 1000×600 window the grown draft reaches the window's foot and its transcript gives up 8px, which moves the reply box's top up 8px. At 608px tall the card grows downward as it did before, and the long draft that follows still bounds it. The four push-tier tests pass on this PR's CI and fail on main without it. The journey's placement assertions now pass, but the journey still errors at teardown with `ResizeObserver loop completed with undelivered notifications`. That error comes from #5811 (`f58c2cac7`), not from #5853 or this change: bisected locally, it's absent at #5811's parent and present at every commit since, including #5853's parent. On main it's hidden behind the placement failure this PR fixes. #5933 tracks it, so the journey stays red until that's fixed. Closes #5917 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
…d keeps (#5894) `leaf-dev probe`, `preview --source` and the fixture builder took a source's package selection from a sibling `layer.json`, reading it as the examples' manifest, a list of package names. A page directory's `layer.json` is its layer record, an object, so probing a real page's `index.html` failed with "unknown package 'format'", though the probe's help says a page directory's `index.html` builds as it stands. `source_packages` now reads a page's record through `layer_record` and takes its packages; the record's theme is left alone, since fixtures build under an empty configuration that takes the default theme. Found while reproducing the thread card gap (#5853) on the page the user commented on. `leaf-dev probe` now builds two real page directories, one with the `diff` package. A new model test fails without the change. `test_preview_file_subscription_follows_atomic_replacements` fails with and without it. > _This was written by Claude Code on behalf of max-sixty_
A thread card, and the comment box before it, stood 8px (
COMMENT_GAP) from the box of the element it is about. Since #4732 moved region marks 6px out, the bracket round that element is drawn 8px outside the same box (a 6px gap and a 2px stroke), so the card's border sat exactly on the bracket's line: its left edge beside the element, its foot over it. The placement now keepssubjectGap, the mark's room plusCOMMENT_GAP, from its subject on every side, so the bracket and the card's edge have the same 8px between them that the card keeps from the window's edge. tokens.css registers--focus-region-roomas a length so the placement reads the token rather than repeating its formula.Measured in Firefox and Chromium on a
layout-columnpage with a comment on anlf-shot: beside it at 1440px, the card's left edge moves from the bracket's outer edge (gap 0) to 8px clear, and the card narrows from 344px to 336px with its right edge still 8px from the window; above it at 1280px, the card's foot moves from the bracket's top line to 8px clear.To weigh: the gap holds whether or not a mark shows, so a card on a passage of words, which draws no bracket, also stands 16px from its paragraph, and a card needs 8px more room before it gives up standing beside and goes under or over. Keeping one gap stops the card moving as the margin trace and Alt aim come and go.
Max asked for this on 4 November; that session committed it on a branch it never pushed, and this PR carries it onto current main. Runtime suite, browser type check, the focused margin and send-placement tests, and the nightly placement sweep pass. CI's
testjob reports one teardown error, a "ResizeObserver loop" window error intest_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[combined-selection]. It comes from the browser tests' swap watch (#5754), not the page: undertaskpolicy -bit fires 3 of 3 times on main and on this branch alike, and 0 of 3 times withswap_watch.jsleft out.