You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Virtual list: shift a running glide's target with the anchor, and anchor on a row the app marks #364
Two issues when older rows are added above a chat's view:
The list keeps what's on screen by moving the offset as rows above are measured or added, but a running glide_to target stays where it was, so the glide overshoots by the amount that was added. We retarget it a frame late from the content's growth, and hold pages that arrive mid-glide until it stops.
The list holds the topmost row in view. At the top of the loaded rows that is the loading placeholder, so a page inserted above went in under it, the placeholder stayed in view and loaded the next page, on to the channel's start. We pin the first real row with keep_on_screen.
Wanted: the glide's target moving with the anchor, and a way to mark which rows may (or may not) serve as the scroll anchor.
Context: found while porting a chat client's desktop UI to Rune (pinned at 565de6b).
A related case from our preliminary work on porting Strata (lgse/strata) from GTK 4 to Rune: a
search list that streams better results in at the top. At offset 0, virtual_rows still holds
the first visible row in place when rows are inserted above it, so the new rows scroll out above
the viewport though the user never scrolled. El::scroll_anchor's docs (el/scroll.rs:134–141
at 29aacb6) say anchoring holds "only while the viewport is … scrolled off its top … at the
very top new content above shows", and that virtual_rows lists anchor "this way".
use rune::{Cx,El,Env,GrowthSpec,Runtime,ScrollSpec, col, el};structS{front:usize}fnkey(s:&S,i:usize) -> String{if i < s.front{format!("a{i}")}else{format!("b{:02}", i - s.front)}}fnview(s:&S, _:&mutCx<S>) -> El{col().key("vp").size(300.0,200.0).scroll(ScrollSpec{stick_bottom:false}).child(col().w_full().growth(GrowthSpec::default()).virtual_rows(s.front + 30,20.0, |s:&S, i| key(s, i).into(), |_:&S, _| el().w_full().h(20.0)))}fnmain(){letmut rt = Runtime::new(S{front:0}, view,(300.0,200.0),Env::new(true,1.0));
rt.frame(0.0);
rt.frame(0.016);
rt.update(|s, _| s.front = 2);for _ in0..30{ rt.frame(0.016);}let y = |k:&str| rt.elements().into_iter().find(|e| e.key.as_deref() == Some(k)).map(|e| e.rect[1]);println!("two rows inserted above at offset 0: a0 at {:?}, b00 at {:?}", y("a0"), y("b00"));}
prints two rows inserted above at offset 0: a0 at Some(-40.0), b00 at Some(0.0) at 5d421fd
and 2a44156. Either skipping the anchor at offset 0, as the docs say, or the opt-out this issue
asks for (anchor on a row the app marks, or none) would cover it.
Part 1 is fixed on dev in #1456 (2800965): when a virtual list shifts the viewport offset as rows above are inserted or measured, any running scroll glide's target offset now shifts by the same anchor delta so the glide lands on the intended content without overshooting.
Leaving this issue open for part 2 (marking which rows may or may not serve as the scroll anchor) and the offset-0 anchoring behaviour raised in the comment above.
use rune::{GrowthSpec,ScrollSpec, col, el};// Skip a top loading placeholder so prepending older pages anchors to the first real row:let loading = el().key("loading").h(36.0).no_scroll_anchor();// Or disable anchoring on a streaming search list so new hits at offset 0 show immediately:let list = col().scroll(ScrollSpec::default()).child(col().growth(GrowthSpec::default()).no_scroll_anchor().virtualize(24.0).child(loading),);
On a row or child (inside virtual_rows, virtualize, or El::scroll_anchor()), no_scroll_anchor() excludes that element and its subtree from anchor selection while preserving default offset-0 prepend anchoring for unmarked lists.
On a virtual_rows / virtualize container or its scroll viewport, no_scroll_anchor() disables automatic anchoring for that list.
Design note: we chose an opt-out builder matching El::no_focus_ring / El::no_window_drag and CSS overflow-anchor: none rather than a separate opt-in row marker, keeping default anchoring unchanged. If your use case still needs explicit anchor priority beyond excluding placeholders, let us know.
Interactive demo: Lists/Scroll anchoring story in examples/playground.
Verified: headless unit and integration tests (scroll_anchor, el::virtual_list, el::scroll, runtime::scroll::sticky, runtime::scroll::requests, playground, and rune-kit scroll tests) on Windows and macOS, plus both wasm32-unknown-unknown compile checks (with and without webgl). Not checked: a live desktop window, Linux runtime tests (Linux container was unavailable), or a real browser.
Activity
wmfeht commentedon Nov 10, 2026
A related case from our preliminary work on porting Strata (lgse/strata) from GTK 4 to Rune: a
search list that streams better results in at the top. At offset 0,
virtual_rowsstill holdsthe first visible row in place when rows are inserted above it, so the new rows scroll out above
the viewport though the user never scrolled.
El::scroll_anchor's docs (el/scroll.rs:134–141at
29aacb6) say anchoring holds "only while the viewport is … scrolled off its top … at thevery top new content above shows", and that
virtual_rowslists anchor "this way".prints
two rows inserted above at offset 0: a0 at Some(-40.0), b00 at Some(0.0)at5d421fdand
2a44156. Either skipping the anchor at offset 0, as the docs say, or the opt-out this issueasks for (anchor on a row the app marks, or none) would cover it.
Hona commentedon Nov 23, 2026
Part 1 is fixed on dev in #1456 (2800965): when a virtual list shifts the viewport offset as rows above are inserted or measured, any running scroll glide's target offset now shifts by the same anchor delta so the glide lands on the intended content without overshooting.
Leaving this issue open for part 2 (marking which rows may or may not serve as the scroll anchor) and the offset-0 anchoring behaviour raised in the comment above.
Hona commentedon Nov 24, 2026
Part 2 and the offset-0 opt-out case are now on
devin #1989 (a5a865200).Added
El::no_scroll_anchor(mut self) -> Self, following CSS Scroll Anchoring Level 1 §2.1 (overflow-anchor: none):virtual_rows,virtualize, orEl::scroll_anchor()),no_scroll_anchor()excludes that element and its subtree from anchor selection while preserving default offset-0 prepend anchoring for unmarked lists.virtual_rows/virtualizecontainer or its scroll viewport,no_scroll_anchor()disables automatic anchoring for that list.El::no_focus_ring/El::no_window_dragand CSSoverflow-anchor: nonerather than a separate opt-in row marker, keeping default anchoring unchanged. If your use case still needs explicit anchor priority beyond excluding placeholders, let us know.Lists/Scroll anchoringstory inexamples/playground.Verified: headless unit and integration tests (
scroll_anchor,el::virtual_list,el::scroll,runtime::scroll::sticky,runtime::scroll::requests,playground, andrune-kitscroll tests) on Windows and macOS, plus bothwasm32-unknown-unknowncompile checks (with and withoutwebgl).Not checked: a live desktop window, Linux runtime tests (Linux container was unavailable), or a real browser.