Skip to content

[mediaqueries-5] scrollbar-type and prefers-scrollbar-type #7420

@bmathwig

Description

@bmathwig

With more user agents implementing overlay-style scrollbars, it's been clear that there is a site compatibility issue that emerges when content or interactive elements are obscured by elements of the scrollbar. To make things more complicated, users have the option to toggle between overlay scrollbars and classic scrollbars via the "Always show scrollbars" operating system settings. This means a page author cannot correctly determine the best course of action to prevent interactive elements from becoming non-interactable.

To help alleviate this issue, I propose adding two new @media descriptors:

@media (scrollbar-type: overlay | classic) { ... }
This query will allow a page author to adjust padding and margins on content that would otherwise be obscured by an overlay scrollbar, but would be just fine with a classic scrollbar. A scrollbar-type can potentially be changed via a future extension to css-scrollbars-1 (#7421).

@media (prefers-scrollbar-type: overlay | classic) { ... }
This query represents the preferred scrollbar type of the user and what they've set in their user preferences.

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