Skip to content

fix: cut a margin card over or under its row only once the row nears a block's top - #7536

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-7528-placement-aim
Nov 28, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-7528-placement-aim

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

This fixes four of the eight journeys #7528 tracks: both column cases of the placement sweep, and both cases of the responsive-draft aim journey.

Placement sweep, product fix. #7442 moved where a bounded block's top starts cutting a margin card. The cut now starts a head line (--lf-card-line, 33px) and a gap above the row's line, so a card beside its row, whose top now stands that far above the line, is cut from nothing. commentBoundary applied that lead to every side. A card over or under its row has no head line level with the row, so the block's top cut it while the row still showed whole. At 1000px the sweep opened a card above #in-4, a row 39px inside the #inner log, and 379px of the card's 402 were cut away. The boundary's cut is now asked with the side (thread-preview.js). A card beside its row keeps #7442's lead, and a card over or under it is cut once the row's line comes within a gap of the edge, as before #7442.

Placement sweep, test update. At 1440px the card stands beside the row, held up by the window's foot, and is cut 35.7px while the row shows whole. That is #7442's intended lead. The sweep's uncut-while-shown allowance assumed a beside card's top stood a gap above the line. It now allows a gap and a head line for a card beside its row, and still allows only a gap for a card over or under it.

Aim journey, test update. test_open_draft_retains_words_when_responsive_layout_hides_its_target aimed at the first #bg-contents a. Since #7473 that is the outline's hidden title link, which Tab never reaches. #7473 landed after #7442, so this pair is a #7473 casualty, the same one #7502 repaired in five browser tests. The journey now aims at #bg-contents a[href='#first'], as #7502 did.

Evidence, by node id on Linux Chromium:

  • test_every_card_keeps_the_placement_rules[column-1000] and [column-1440] fail on 6313a6f59, and pass with this change. [column-1000] still fails with the test update alone, which shows the product fix is needed.
  • test_open_draft_retains_words_when_responsive_layout_hides_its_target[False] and [True] fail on 6313a6f59 and pass with this change.
  • The other four sweep cases still pass, and so does test_a_card_on_a_log_row_stands_beside_the_log_and_leaves_with_its_row, Head a margin card with its thread's title, and let each message's name scroll with it #7442's test of a beside card's cut growing from nothing. tests/runtime/comment-placement.test.mjs passes.

The other four journeys in #7528 (two margin-draft journeys, the thread walk and the long text document) are not touched here.

Refs #7528 — automated triage

…'s top

#7442 moved a block's top cut to start a head line (`--lf-card-line`) and a gap above the row's line, so that a card beside its row, whose top now stands that far above the line, is cut from nothing. `commentBoundary` applied that lead to every side. A card over or under its row has no head line level with the row, so the block's top cut it while the row still showed whole. In the placement sweep at 1000px, a card above `#in-4` showed 23px of its 402. The boundary's `cut` now takes the side, and only a card beside its row keeps the head line's lead.

The placement sweep's `uncut-while-shown` allowance follows #7442's lead for a card beside its row: a gap and a head line, where it was a gap.

`test_open_draft_retains_words_when_responsive_layout_hides_its_target` aimed at the first `#bg-contents a`, which since #7473 is the outline's hidden title link. It now aims at `#bg-contents a[href='#first']`, as #7502 did for five browser tests.

Refs #7528

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new header on commentBoundary says that a card over or under its row has its top a gap above the row's line, so a block's top cut grows from nothing. That holds only for a card beside its row. A card above its row has its top a gap plus its own height above the line, so once the line comes within a gap of a block's top, the cut takes nearly the whole card at once. A card below its row has its top below the line. The code does what the PR description says: it brings back the pre-#7442 rule for those sides. Only the stated mechanism is wrong, and the sweep's comment repeats it. The suggestions state the rule without the false mechanism. I'll push them as one commit.

The header claimed such a card's top stands a gap above the row's line, so
its cut grows from nothing. A card above its row stands its own height
higher, so that holds only beside the row. No behavior changes.
@leaf-agent
leaf-agent merged commit 130f053 into main Nov 28, 2026
8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7528-placement-aim branch November 28, 2026 17:53
leaf-agent added a commit that referenced this pull request Nov 29, 2026
… its line (#7601)

A thread walk opens its card before its landing scrolls the card's words
into view. `commentPlacement`'s `choose` reopened the card only for
moves Leaf started in the boundary's scroller, which is the page. In a
long text document the walk scrolls the document's own `<pre>`, so the
card never reopened. It kept the spot it took while line 840 was clipped
(`held.top = -35438` from the line), and limitShift stood it at −35,067
px. A second `t` in the same frame found focus out of sight, and the
walk returned to line 840 instead of moving on to 880. #7442's taller
card exposed the defect: with the card 20 px shorter, limitShift's lower
bound happened to win, so the card landed in view by luck.

`choose` now counts moves Leaf started in every box that carries the
subject, out to the boundary's scroller (`startsUnder`, built on
`scrollersOf`). When the walk's landing reopens the card, the card drops
its held spot and is placed again where the landing left its words. It
keeps the side it chose, as the module header already said it should. A
scroll from `makeRoom` still resets the count through `scrolled()`, so
the card's own room-making never reopens it.

Verification, by node id on Linux:
-
`tests/journeys/widgets/test_code_and_documents.py::test_a_long_text_document_draws_the_lines_in_view_and_keeps_the_rest_whole[browser]`
and `[firefox_browser]` fail on `6e1977ac0` (`assert 1 == 2` on `steps`)
and pass on this branch.
- The placement sweep `tests/journeys/margin/test_card_placement.py`,
the thread-walk and pane-walk browser tests,
`test_a_thread_walk_card_leaves_and_returns_with_its_anchor`, and
`tests/runtime/{comment,floating,margin,scroll}-placement.test.mjs`
pass.
- The `browser/types` type check and eslint are clean.

This was the last of the eight journeys #7528 tracks. #7535, #7536 and
#7537 fixed the other seven.

Closes #7528 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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.

1 participant