Skip to content

fix: credit an anchored box whose inset adds a multi-term offset to its anchor's edge - #7390

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-7389
Nov 27, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-7389

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The shift watch credits a box that follows its CSS anchor through a scroll only when it can read the anchoring from the box's inset. Until now it accepted anchor(side) alone or with one length or var() added. The heading link's top (browser/styles/components/integration.css, .lf-heading-link) is calc(anchor(top, -9999px) + var(--lf-heading-link-top, 0px) + (var(...) - var(...)) / 2 + var(--lf-block-control-dy, 0px)), so the watch couldn't credit it. In test_a_heading_copies_the_link_to_the_section_it_opens, the script's location.href navigation to #rates%252Flimits scrolls the page 50 px, and the link moves with its heading, which is correct. The watch reported that move as residual, with no scroll terms. On an idle machine the earlier click's rendering still owns the scroll, so nothing gets reported. On a slow CPU that rendering has closed before the navigation, and the test errors at teardown.

The watch now credits an inset whose calc() sum has the anchor's edge as one added term, as long as no other term reads an anchor. That remaining part is an offset the anchor's travel doesn't change. Forms where the edge is subtracted, scaled or nested still get no credit, and the header says so. The code block's Copy control uses the same multi-term form, so it is covered too.

Verification:

  • test_a_heading_copies_the_link_to_the_section_it_opens errored every time at --cpu-throttle 4 before the change. After it, the file passes at throttles 4 and 8, and leaf-dev suite flake --copies 6 --cpu-throttle 6 passed 6 of 6.
  • A new offset_sum declaration in test_native_anchor_scroll_retains_local_motion_proof covers the clean case, which fails without the change, and a case where the anchor moves independently, which still fails. The other anchor, portal and popover cases in test_render_shift_watch.py and margin/test_pins.py pass.

The watch changes; no product code does.

Closes #7389 — automated triage

…ts anchor's edge

The shift watch credited a box for following its CSS anchor through a scroll
only where the inset read `anchor(side)` alone or plus one length or var(). A
heading's link stands at `calc(anchor(top) + var(...) + (var(...) - var(...)) / 2
+ var(...))`, so the watch gave it no credit, and a scroll no input owned, such
as a script's fragment navigation, reported the link moving with its heading.
On an idle machine the earlier click's rendering still owned that scroll; on a
slow CPU it had closed, so the test failed.

The watch now credits an inset whose calc() sum holds the anchor's edge as one
added term and no other term reading an anchor. A new case in the watch's
anchor-scroll test covers that form and fails without the change.

Closes #7389
@max-sixty
max-sixty merged commit 0a9916d into main Nov 27, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/issue-7389 branch November 27, 2026 14:13
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.

test_a_heading_copies_the_link_to_the_section_it_opens: the heading link's copy button moves 50 px without input when the CPU is slowed

2 participants