Repository navigation
feat(scroll): add El::no_scroll_anchor and virtual-row descendant anchoring - #1989
Merged
Merged
Conversation
Hona
force-pushed
the
feat/364-scroll-anchor-opt-out
branch
from
November 24, 2026 17:07
cadbdc3 to
9ba1916
Compare
Hona
force-pushed
the
feat/364-scroll-anchor-opt-out
branch
from
November 24, 2026 17:09
9ba1916 to
750a7e6
Compare
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.
Fixes #364
Fixes #1679
Summary
El::no_scroll_anchor()(crates/rune/src/el/scroll.rs): opt-in equivalent of CSS Scroll Anchoring Level 1 §2.1overflow-anchor: none, stored onScrollEdges(no size increase onElorNode).El::scroll_anchor()andVirtualList.virtual_rows/virtualizecontainer or its scroll viewport, disables automatic virtual-list anchoring so prepends at offset 0 reveal at the top without shifting existing defaults.VirtualList::row_no_anchorstay lazily unallocated when unused, preserving zero extra allocations on initial load and rekey.virtual_rows(crates/rune/src/runtime/scroll/anchor.rs,sticky.rs,commit/measure.rs,commit/remount.rs): follows CSS Scroll Anchoring Level 1 §2.2 Anchor Node Selection.El::scroll_anchor()descends into a tall mountedvirtual_rowsrow whose top starts above the viewport top to capture a bounded chain of visible interior candidates, promoting the first surviving live candidate inapply_keepsif the primary node is removed or begins exiting.VirtualList's row-level anchor path; unmounted rows fall back viaKeep::virtual_row.st.shift_anchor(delta)inmeasure.rsandremount.rsis skipped whilescroll_requests.owns(&scroll_path), preventing double-shifts when aKeepowns the viewport.Lists/Scroll anchoringstory inexamples/playground/src/scroll_anchor_story.rs, updated rustdoc onEl::scroll_anchor/El::no_scroll_anchorandcrates/rune/README.md, and added a changelog fragment.Usage
Anchor selection flow
flowchart TD A["scroll_anchor() viewport"] --> B{"Child no_scroll_anchor() / sticky / exiting?"} B -- Yes --> C["Skip subtree, try next sibling"] B -- No --> D{"Virtual list container?"} D -- Yes --> E{"Row top < viewport top - 0.5?"} E -- No --> F["Leave to VirtualList whole-row anchor"] E -- Yes --> G["Descend into mounted row (CSS §2.2)"] G --> H["Capture primary + surviving fallbacks + virtual_row"] H --> I["Skip coarse shift_anchor while Keep owns viewport"] I --> J{"Primary live after commit?"} J -- Yes --> K["follow_keeps tracks drawn Y"] J -- No --> L{"Surviving fallback live?"} L -- Yes --> K L -- No --> M["apply_keeps restores via virtual_row & remounts"]