-
Notifications
You must be signed in to change notification settings - Fork 677
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-values] Use of 100vw is causing pointless horizontal scrollbars on some websites #6026
Comments
See #1766. Not very easy to do them auto-magically work because it'd be cyclic (declarations using vw units could cause scrollbars to appear which would change how vw would resolve). It'd be feasible to make them work with with overflow: scroll, but only Firefox implemented that and nobody else did so we removed that... |
@emilio I did not suggest to make changes to viewport units. I asked if the Working Group plans to do something about the problem of pointless horizontal scrollbars that appear on some websites, a problem that I predict will not go away on its own. Does this problem require an intervention or can it be ignored? |
I guess we can reopen, but it's hard to say from a web engine when a scrollbar is "useless" if there's content overflowing. |
Related: #5254 |
Also related: #5232 |
Percentages are not cyclic now, so why couldn't <body>
<div class="one" style="width: 100%;"></div>
<div class="two" style="width: 50%;">
<div class="two-child" style="width: 100vw;"></div>
</div>
</body>
|
Because percentages aren't resolved until layout, while viewport units are. More generally, content inside the viewport can't affect the viewport size, but it can affect whether the root element shows scrollbars or not. |
@emilio Okay so why not create a new unit (or modify |
Well, that is one option. Note that that would behave subtly differently than the current viewport units. Adding layout-time relative units is relatively hard (no pun intended) compared to adding units that resolve at computed-value time like vh / vw. Though definitely not impossible. |
Also related: #4329 |
@emilio I don't know too much about the actual rendering processes, but this description makes it seem like it would be easier to calculate as there wouldn't need to be any tree traversal to compute, there would just be the one root node to be concerned with. But I understand there has to be more to it.
Very confusing as their use of "viewport width" isn't the same as the |
Also related: #4691 |
Related oddbird/sliiides#3 |
I'm thinking we should go back to making them work with |
Is my understanding correct that there is currently no way to size elements to the viewport minus the scrollbar while also having non-floating elements outside the viewport, since using EDIT: Apparently it is not. The root element's width can be inherited to any place in the document by having anything outside the viewport overflow it. |
I suppose, that a new unit should be implemented, which determine viewport width and height without scrollbars. |
this? #6113 |
yep! exactly! |
@frivoal Do you think you'd still rather go this way instead of having non-overlay scrollbars (both inline and block) affect the new |
To approach this from a "how does someone without in-depth knowledge of the functionings of the browser understand the concept of the viewport" perspective, I've talked to developers frustrated by this issue. The mental model boils down to this:
From this perspective, which is the user perspective in this context, the implementation of any new units like |
Maybe the distinguishing factor is whether the thing (scroll bar, in your example) is visible when the user is idling (I.e. not interacting with the page). What do you think? |
@brunoais Yes, that's a different (and possibly clearer) way of saying the same thing. |
@brunoais What’s the risk here? Are there websites with |
The issue is mostly on the designers. They are SUPER picky about even a pixel off. Where I work at, there's an idea about background coloring on If my request is rejected, so be it but that's my reality. |
@brunoais Most of them probably don’t set |
Is it possible to create a property similar to box-sizing (viewport-sizing?) that only works on :root? That way people could explicitly opt in to the behavior, similar to the way most sites use box-sizing: border-box instead of the default content-box. |
I know that will happen regardless, but it might trip up authors as That confusion could be solved by doing something similar for (This looks like food for a follow-up issue)
The
This mimics what authors are currently doing, with the different that the scrollbar-width is reported by the browser here. But, as @emilio mentioned, this would also require a way to detect classic scrollbars. It would also require a way to detect if something is scrolling or not … which would make this all very complicated for authors to implement, as demonstrated in this snippet I presented at the 2023 summer F2F. So yeah, maybe this Winging back to @bfgeek’s concern: I’ve asked some colleagues to query the HTTP archive to see:
I’m still waiting on the results of these queries. |
Some use cases: most of our sites uses These sites often have modal UI that hides overflow on root ( Dropdown menus with absolutely positioned children (ie: full width dropdown that "breaks out" of it's parent), rely on using the |
I ran some tests and here are the results: In total 12,089,606 root pages found in the HTTP Archive November 2023 Dataset were scanned. Out of those 12 million scanned pages:
Of those 72 pages, only 38 seem to use the Conclusion: If we change how |
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> iank_: I think now, with Bramus's data, this is likely fine<TabAtkins> iank_: Bramus did a lot of analysis on it. still a little concerned, but someone can take the risk and see what happens <fantasai> Bramus wins MVP of the issue! \^_^/ <fantasai> TabAtkins: When overflow is set on the root element (specifically; not body), we will take the scrollbars into account when calculating viewport unit sizes <TabAtkins> iank_: Yes, specifying overflow:scroll on the root is sufficiently rare that people shouldn't run into this <TabAtkins> iank_: Probably won't solve the general case on existing sites, but people can fix it moving forward <TabAtkins> iank_: One caveat is that enterprise is always hidden in this type of analysis, so if someone rolls it out there might be a hidden part that changes our resolution <TabAtkins> TabAtkins: +1 <TabAtkins> fantasai: Why didn't we want to do it for body propagation? Too common? <TabAtkins> iank_: yes, I think itwould break way too many sites <TabAtkins> fantasai: Other thing in the thread is having the dv* units respond to scrollbar <astearns> previous resolution: https://github.com//issues/6026#issuecomment-1832443514 <TabAtkins> fantasai: So I guess it would make sense to say that dv* would respond to scrollbar... <TabAtkins> TabAtkins: dv* units are always between small and large units, right now; we should be careful about losing that <TabAtkins> astearns: I linked to the existing resolution that already covers this, this discussion is about us not undoing that <TabAtkins> Rossen_: so keep no change? <TabAtkins> Rossen_: Objections? <TabAtkins> RESOLVED: No change, keep with the existing resolution <TabAtkins> Rossen_: do we need something for the dv units? <TabAtkins> fantasai: No, we should do that in a separate issue <miriam> q+ <TabAtkins> miriam: do we also need, in the new issue, to mention CQ units? <Rossen_> ack miriam <TabAtkins> fantasai: would need to be a more separate issue |
Edits are done for the WG resolution in #6026 (comment) and filed follow-up wrt |
…or scrollbars, a=testonly Automatic update from web-platform-tests [css-values-4] Add viewport unit tests for scrollbars w3c/csswg-drafts#6026 -- wpt-commits: 82a8422a00e43a2327d0f22c5941a23294f2ecb9 wpt-pr: 45036
…or scrollbars, a=testonly Automatic update from web-platform-tests [css-values-4] Add viewport unit tests for scrollbars w3c/csswg-drafts#6026 -- wpt-commits: 82a8422a00e43a2327d0f22c5941a23294f2ecb9 wpt-pr: 45036
Windows users and macOS users that have enabled “Show scroll bars: Always” are seeing pointless horizontal scrollbars on some websites that use the
100vw
value. One common use-case for100vw
are full-width elements:Examples:
If you can’t check for yourself and are not sure what a pointless horizontal scrollbar is, watch this video that I posted on Twitter.
The authors of these websites are most likely not aware of this issue because they developed the website on macOS with default (overlaid) scrollbars, where this issue does not occur.
As a result, many people are experiencing these pointless horizontal scrollbars, and a fair share of these people probably find them annoying (raises hand 🙋♂️).
Does the Working Group consider this to be a problem that requires an intervention? Are there any proposed features or changes that could help make this problem go away over time?
The text was updated successfully, but these errors were encountered: