Skip to content

[css-color-adjust-1] Root viewport non-overlay scrollbars should follow the user's preferred color scheme by default #8603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yshalivskyy opened this issue Mar 16, 2023 · 5 comments
Labels
Agenda+ Later Lower-priority items that are flagged for CSSWG discussion css-color-adjust-1 Current Work

Comments

@yshalivskyy
Copy link

Root viewport non-overlay scrollbars don't follow the user's preferred color scheme set using OS or browser appearance setting when the CSS color-scheme property for a given container or color-scheme meta tag is unspecified or set to normal (default). Many web pages don't specify the support for light/dark color schemes using CSS color-scheme property or color-scheme meta tag. In such a case, the used color scheme is light for scrollbars and other interactive UI elements despite the user preference set on the browser/OS level. The behavior creates a confusing experience for users who have selected dark mode as a preferred color scheme and expect interactive UI elements like scrollbars to follow their choice.

The experience is particularly drastic for root non-overlay scrollbars, which always stay on the side of the page and are treated by users as a part of the browser UI. Example user feedback for Edge and Chrome.

I propose adjusting the calculation of the used color scheme for the root non-overlay scrollbar to follow the user's preferred color scheme by default if a page author doesn't override user's preference by root CSS color-scheme property or meta tag. Effectively, nothing will change if the user's preferred color scheme is light. However, if the user's preferred color scheme is dark, the root scrollbar will follow the user's preference. Other scrollbars and elements will follow the existing logic for used color scheme calculation.

@fantasai fantasai added css-color-adjust-1 Current Work Agenda+ Later Lower-priority items that are flagged for CSSWG discussion labels Mar 16, 2023
@lilles
Copy link
Member

lilles commented Mar 16, 2023

If the viewport scrollbar is considered part of the UI, why should the color-scheme from CSS affect the viewport scrollbar at all?

Wouldn't a color-scheme:dark making the viewport scrollbar dark, when the preferred color-scheme is light, be equally unexpected?

@yshalivskyy
Copy link
Author

It's a good question! I think page authors could leverage the control over page elements inside the viewport, including root scrollbars. Suppose the authors explicitly specified that the light scheme is unsupported (via color scheme or meta tag). In that case, in my opinion, the UA should honor the decision unless the forced colors mode overrides the setting for accessibility purposes.

I don't think we should treat the root viewport scrollbar entirely as a part of the browser UI. However, changing the default behavior when page authors don't specify their preference might benefit many users across the web and improve their experience.

@lilles
Copy link
Member

lilles commented Mar 29, 2023

Can this be summarized as?:

If the both of these hold, the user agent should use the user's preferred color-scheme to render the viewport scrollbars:

  • The value of "page’s supported color schemes" is 'normal'
  • The computed value of color-scheme for the root element is 'normal'

@yshalivskyy
Copy link
Author

This is the perfect summary!

aarongable pushed a commit to chromium/chromium that referenced this issue Mar 30, 2023
Problem statement

Root viewport non-overlay scrollbars don't follow the user's preferred
color scheme set using OS or browser appearance setting when the CSS
color-scheme property for a given container or color-scheme meta tag is
unspecified or set to normal (default). Many web pages don't specify the
support for light/dark color schemes using CSS color-scheme property or
color-scheme meta tag. In such a case, the used color scheme is light
for scrollbars and other interactive UI elements despite the user
preference set on the browser/OS level. The behavior creates a confusing
experience for users who have selected dark mode as a preferred color
scheme and expect interactive UI elements like scrollbars to follow
their choice.

The experience is particularly drastic for root non-overlay scrollbars,
which always stay on the side of the page and are treated by users as
a part of the browser UI.

w3c/csswg-drafts#8603

Proposed solution

Make root non-overlay scrollbars follow the user's preferred color
scheme when the CSS color-scheme property for a given container or
page-wide meta tag is unspecified or set to normal (default).

List of changes:
- Renamed the ScrollableArea::UsedColorScheme()
to UsedColorSchemeScrollbars() to highlight that the method was only
used for scrollbars.
- Implemented the new behavior in
PaintedScrollbarLayer::UsedColorSchemeScrollbars().
- Added changes under the UsedColorSchemeRootScrollbars feature flag.
- Added unit tests.

Bug: 1423087
Change-Id: I0d4bfebee96a815f55465222a140e3c8a5fc3572
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4322518
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Yaroslav Shalivskyy <yshalivskyy@microsoft.com>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124024}
@willfs84
Copy link

willfs84 commented Jan 31, 2024

I think relevant? https://bugzilla.mozilla.org/show_bug.cgi?id=1859940

Even though Firefox handles scrollbar theming differently to Chromium (Firefox makes the scrollbars dark far more frequently than Chromium), there's still a case where, on some websites in dark mode, when the user pinch-zooms in, the scrollbars that appear are light. Examples are https://mod.reddit.com/mail/all and https://outlook.live.com/mail/0/ when set to dark mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agenda+ Later Lower-priority items that are flagged for CSSWG discussion css-color-adjust-1 Current Work
Projects
Status: Unslotted
Development

No branches or pull requests

4 participants