Skip to content

[css-scroll-snap] Different browsers implement keypress scrolling differently #2929

Closed
@cruxicheiros

Description

@cruxicheiros

Relevant section: https://drafts.csswg.org/css-scroll-snap/#scroll-padding
Related to thread "define scroll amount by CSS" http://lists.w3.org/Archives/Public/www-style/2018Jul/subject.html

CSS Scroll Snap introduces the attribute scroll-padding which allows CSS style sheets to specify an offset that the page will not scroll into when the space or page down buttons are used to scroll. This is important because otherwise, text that the user had not yet scrolled to would be hidden behind the header.

However, Firefox attempts to automatically detect sticky headers and does this already (described in this Bugzilla post. From my testing, Chrome, Edge, and Opera do not have this feature, making Firefox the odd one out.

I have created a demo site to help easily demonstrate this difference.

The reason this is relevant to CSS Scroll Snap is that with its introduction, guidance should be given on how scrolling should work when the attribute is not present. Scrolling behaviour should be standard across browsers.

Firefox's approach has benefits in that it fixes the problem scroll-padding aims to solve on already-existing websites. Therefore it might be beneficial for other browsers to do similarly. However, this could result in clashes when scroll-padding is used in a stylesheet on a website the browser has detected as using a fixed header and has already applied an offset to.

Firefox's detector, however, is not perfect and does not work on all sites. This page is an example where the offset should be applied and isn't.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions