[csswg-drafts] [css-om-view] Scrolling a sticky element into view should use normal flow position for sticky boxes

flackr has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-om-view] Scrolling a sticky element into view should use normal flow position for sticky boxes ==
To [scroll an element into view](https://drafts.csswg.org/cssom-view/#scroll-an-element-into-view) the spec says that you should use the element's bounding border box returned from getBoundingClientRect. For sticky elements which are currently sticking trying to scroll to their current position could result in them moving further away or not being visible due to multiple similar sticky elements (e.g. click on the boxes or anchor links after scrolling down on http://jsbin.com/simivof/edit?html,output). This pattern of the previous sticky title being covering up the next one seems to be a common one.

I think the expected behavior when trying to scroll to a sticky element, at least by anchor, and probably also for scrollIntoView, would be to scroll to the element's normal flow position before applying the sticky offset. This will be a stable position and is most likely to result in the element actually being visible. It's actually hard to get this behavior otherwise as if you wrap a box around the sticky element for an anchor it will contain it and prevent the sticky element from moving.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1459 using your GitHub account

Received on Tuesday, 23 May 2017 20:36:38 UTC