A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] Scroll Anchoring

skobes
2016-10-10

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.)

jhpratt
2016-10-11

100% in favor. With regards to the CSS attribute values, I think float and anchor, rather than none and visible could work.

chenzx
2016-10-22

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.

skobes
2016-10-27

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.

stuartpb
2016-11-05

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?

tabatkins
2016-11-05

No, that’s an orthogonal issue to the problems that Scroll Anchoring is solving.

cwilso
2016-12-02

Moved: https://github.com/WICG/ScrollAnchoring.