This is a proposal to transfer the ScrollAnchoring repo to the WICG.
Scroll anchoring is a new web platform behavior that adjusts the scroll position to prevent visible jumps when content changes above the viewport (for example, ad insertion or images loading).
It introduces CSS
overflow-anchor as an opt-out for developers.
(A copy of the explainer and draft spec are also available in the WICG Interventions repo, but we’d like to make it a separate repo for issue tracking.)
100% in favor. With regards to the CSS attribute values, I think float and anchor, rather than none and visible could work.
There are 2 situations which current scroll anchoring mechanism cannot solve：
1、if the screen(visual viewport) is currently all of text paragraph, that is to say, no DOM nodes happen to stay there inside of screen, scroll anchoring will not work.
To solve this, better to use some Hit-test mechanism to select a Visible Position based on text characters, the text-wrap in Opera’s chromium based browser kernel code implements this;
2、even with switching from DOM node based scroll anchoring to Visible Position based, there is still a usability loss potentially: if current screen doesn’t display any text or dom nodes, but display some CSS generated contents, or borders、blanks、canvas(size bigger than screen size) etc. This corner case will be really difficult.
chenzx: If text fills the viewport, the DOM text node corresponding to that text will be selected as the anchor node. Scroll anchoring will then adjust correctly for changes to DOM content preceding the text node.
It won’t adjust in response to changes inside the text node itself, for example adding a sentence at the beginning of the text (even if that part of the text is above the viewport). But that is not a common scenario.
Is there a provision in the scroll-anchoring spec for the initial scroll position when content is loaded (for instance, to start with the last element in a container scrolled into view, or with scrolling starting in the center of the element)? Could there be?
No, that’s an orthogonal issue to the problems that Scroll Anchoring is solving.