-
Notifications
You must be signed in to change notification settings - Fork 667
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
[css-overflow-4] Effect of scrollbar-gutter on viewport #8099
Comments
RE Chrome vs “The reported value through This is as per current spec:
I say this feels wrong here because the visualised ICB (red dashed outline) does not match the reported values. Therefore I would like to suggest to adjust this definition so that it also caters for reserved scroll bar space. |
RE “I would expect browsers to only resize the layout viewport when the scrollbars are actually present” and “I would expect browsers to not reposition the layout viewport” This is from a POV where authors should be able to entirely cover the viewport. However, as An updated expectation in that case – putting visual stability first – would be the opposite as I have suggested:
This way layout remains stable when the content grows/shrinks: You can try this out in this demo: https://cdpn.io/pen/debug/PoaEgoW/629275fd041fcf38696ee70e6ee75974 (source)
(Firefox works as expected here. Chrome affected by https://bugs.chromium.org/p/chromium/issues/detail?id=1251856) BUT, I’m still wondering about how authors could then cover the viewport entirely, especially when using Using negative insets – set to Maybe it should simply be accepted that Or maybe the proposed |
I want to add that |
Is Chrome’s behavior buggy? I checked in Chrome stable (version 116), and the LVP did resize even though the scrollbar is not present. <div class="fixed">987654321</div> html {
scrollbar-gutter: stable;
}
.fixed {
position: fixed;
inset: 0;
background: gold;
text-align: right;
} Test page: https://output.jsbin.com/xeyubex/quiet As you can see in the screenshot, the right-aligned text is fully visible. However, if I resize the browser window, the LVP grows, and the last two numbers “21” are hidden behind the gutter. This must be a bug. |
Hm, I’m leaning towards not resizing the layout viewport.
The “layout” is the layout of fixed-positioned elements. The page layout is already stable because the ICB is resized (by |
Another thing that should probably be tested and debated is the effect on the visual viewport. Currently, the following two statements are true:
If the decision is made that
The most sensible option would probably be to reduce the width of the layout viewport, but not to reduce the width of the visual viewport. The main question is, would having the visual viewport be wider than the layout viewport cause breakage on websites. |
I want to emphasize again that scrollbar-gutter is too complex(#4674). Maybe env(scrollbar-inline-size) #4691 is a better way out. cc @argyleink Normally when opening a modal dialog we want the page behind it not to be scrollable, which requires adding
This is a very important scenario that seriously affects the usability of the Demo: https://scrollbar-gutter-stable-bug.glitch.me/
data:text/html;charset=UTF-8,<!doctype html> <style>html { scrollbar-gutter: stable both-edges; background: linear-gradient(to right, green, yellow) red; } * { margin: 0; padding: 0; }</style> <span class="foo">test 2024-08-30 updateThe scrollbar-gutter has been implemented in Safari TP and doesn't seem to have this bug. |
In #9904 (comment) we resolved that top layer / fullscreen elements paint over the gutters. I think that solves your problem, @yisibl. |
@bramus Could it be that this fix now causes position fixed In the attached video the nav that appears is a I'm not 100% sure in which Chromium version the fix you mention was released though: CleanShot.2024-06-20.at.10.04.00.mp4 |
There should be three scenarios here, #9904 (comment) seems to solve only the first case.
|
The use case is a fixed header / navigation bar, which is very common for all kinds of applications. When the scrollbar disappears and |
I would love to see a demo of that. (Sorry, I haven’t started testing with popover yet, so I’m not familiar.) Fixed-positioned elements normally cannot overlay a page’s classic scrollbar nor scrollbar gutter, so if a popover can do it, that is a new behavior that changes things significantly. |
Testing the behavior of various browsers wrt
scrollbar-gutter
tells me it’s not interoperable. The spec doesn’t really define what should happen, so this needs work.The tests
All tests are being run using the dedicated test pages on https://interop-2022-viewport.netlify.app/. Using the options on each testpage, the
vw
bars have been hidden so that they don’t cause extra overflow.scrollbar-gutter: stable
(short content)scrollbar-gutter: stable
(long content)scrollbar-gutter: stable both-edges;
(short content)scrollbar-gutter: stable both-edges;
(long content)(I’ve only had time to test desktop browsers with support on macOS with scrollbars set to always visible)
Findings
stable both-edges
and the fact that the LVP gets resized.document.documentElement.clientWidth
is wrong, though.stable both-edges
when the scrollbars are actually there.Expected results
I would expect browsers to resize the ICB, so that things like viewport units remain stable. This is currently correct in all browsers.
I would expect browsers to only resize the layout viewport when the scrollbars are actually present. This way it’s possible for a fixedpos element to cover the entire viewport.
If the LVP were to be resized when no scrollbars are visible, an author would not be able to cover the entire viewport in case
stable
is used: there would be a small strip visible on the scrollbar area.I would expect browsers to not reposition the layout viewport – not even when
stable both-edges
is used. This again for fixedpos element purposes. If the LVP were to be repositioned, an author would not be able to cover the entire viewport in casestable both-edges
is used: there would always be a small strip visible on the opposing side of the scrollbar area.The text was updated successfully, but these errors were encountered: