Skip to content
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

How should UAs hide root element scrollbars? #236

Open
nt1m opened this issue Jan 27, 2024 · 7 comments
Open

How should UAs hide root element scrollbars? #236

nt1m opened this issue Jan 27, 2024 · 7 comments

Comments

@nt1m
Copy link
Member

nt1m commented Jan 27, 2024

What is the issue with the Fullscreen API Standard?

All existing UAs currently hide the root element scrollbars when fullscreen, but they all do so in different ways:

  • Chrome & Firefox I believe have special logic that prevents scrolling + hides scrollbars
  • Safari has an overflow: hidden !important UA rule on *|*:root:-webkit-full-screen-document:not(:fullscreen)

I wonder if we can get a standardized way of doing this. Something like:

*|*:root:has(:fullscreen) {
    overflow: hidden | clip !important;
}

(UAs may not necessarily want to use :has() for performance reasons, but the idea would be something like Safari implements).

Also, not sure if clip or hidden is closer to the wanted behavior here, but I think I'd be OK with either.

cc @whatwg/css

@nt1m
Copy link
Member Author

nt1m commented Jan 27, 2024

cc @upsuper

@nt1m
Copy link
Member Author

nt1m commented Jan 27, 2024

I found some context around Gecko in https://bugzilla.mozilla.org/show_bug.cgi?id=1201798

@nt1m
Copy link
Member Author

nt1m commented Jan 27, 2024

Seems Gecko chose custom code to avoid frame reconstruction when going fullscreen? In which case overflow: clip (which wasn't implemented at the time Gecko made the change) might be a better choice?

@upsuper
Copy link
Member

upsuper commented Jan 27, 2024

All existing UAs currently hide scrollbars when fullscreen

... and the fullscreen element is not the root element, which is correctly reflected in your standardized UA style, though :)

We used custom code in Gecko both to avoid frame reconstruction and to remove :-moz-full-screen-ancestor which was a removed part of the standard.

It seems that Gecko style code has got finer-grained update over overflow changes, so the first reason may not apply anymore.

I guess a standardized way using :has is probably okay, and client can continue to use their custom code to do the override as long as it has the same effect.

@nt1m nt1m changed the title How should UAs hide scrollbars? How should UAs hide root element scrollbars? Jan 27, 2024
@nt1m
Copy link
Member Author

nt1m commented Jan 27, 2024

Is this behavior currently overridable by websites in Gecko? Just wondering whether !important is appropriate here in the UA style.

@upsuper
Copy link
Member

upsuper commented Jan 27, 2024

Is this behavior currently overridable by websites in Gecko? Just wondering whether !important is appropriate here in the UA style.

I don't think it's overridable by websites in Gecko, and conceptually I don't think it should be either, so I'd say !important is appropriate and it should help simplify simulating the behavior with custom code.

@foolip
Copy link
Member

foolip commented May 17, 2024

I think the code that makes this work in Chromium is this:

:root:-webkit-full-screen-ancestor {
  overflow: hidden !important;
}

:-webkit-full-screen-document was used previously, but changed in https://codereview.chromium.org/807473002.

Specifying this with :has() sounds reasonable, but I'm wondering why it shouldn't just be overflow: hidden !important? Would changing it to overflow: hidden | clip !important be observable in any way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants