[css-position-3] Revisit the scroll position of sticky-positioned boxes · Issue #7930 · w3c/csswg-drafts (original) (raw)

In #1459 I raised an issue around the behavior of scrolling sticky elements (or descendants) into view. In particular since scrolling an element into view used the sticky element's current bounding border box returned from getBoundingClientRect, this could result in:

As a result, we updated the spec to use the non-offsetted position for scroll operations.

Since this update, chromium implements this behavior behind experimental web platform features which fixes this issue as well as issues with input fields combined with scroll-padding (e.g. bug 1178622) however the experimental behavior has also raised many bugs about the scrolling being unexpected (e.g. bug 1334207). I expect we will see many more bugs filed if we attempt to enable this behavior by default as input fields within sticky headers is a common practice for search fields.

The TLDR, we have two options:

  1. Scroll to the current position - Current behavior in Chrome (without flag), Firefox and Safari.
  2. Scroll to the non-offsetted position - Current spec behavior implemented in Chrome behind experimental web platform features flag.

I propose that we revert the spec change and go back to the currently shipping behavior (option 1) for two main reasons: