W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2017

Re: [csswg-drafts] [css-values] Should viewport units still depend on scrollbar width for overflow:scroll?

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Wed, 30 Aug 2017 17:16:35 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-326058971-1504113387-sysbot+gh@w3.org>
Summarizing the impl complexity:

1. Adjusting the viewport unit size based on `overflow` is about as hard as the `em` unit, which requires some work to make performant.
2. Additionally, you might have to pipe the value *up* one level, if `body` is controlling the window scrollbar.
3. In Firefox the size of the scrollbar isn't page-controllable, but it is based on some OS information, which is currently queried only in the scrollbar layout code, which has the practical effect that it depends on layout information. This could be fixed by pulling the OS queries upward and piping the information into both scrollbar layout and viewport unit calculations, but that's new code to be written. (Alternately, just duplicating the queries in the viewport unit calculations.)
4. In WK-based browsers, the scrollbar size is page-controllable, via the `::-webkit-scrollbar-*` pseudo-elements. If this is taken into account, the viewport units become *inextricably* layout-dependent, which defeats the original effort to make them computed-value-time absolute units.

* For 1/2, it shouldn't be quite as expensive as `em` units, as it's not dynamically changeable per subtree. You check exactly *one* element's property value, and the whole tree responds accordingly. Still have to pipe the data around and figure out what needs refreshing, of course.
* For 3, this should be a minor impl complexity deal.  The information isn't layout-dependent at all, it just happens to only be calculated during layout right now.  It can be fixed.
* For 4, I'm happy to have vw only respond to the *default* width of the scrollbar.  If you manually set the scrollbar width on the root element, it actually *is* quite easy to set up a `--var` on `html` equal to the viewport size minus your custom width.  This is an *intrinsic* restriction of the feature, not an incidental one, and it's okay for it to not have 100% fidelity as a result.  It's also quite rare.

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1766#issuecomment-326058971 using your GitHub account
Received on Wednesday, 30 August 2017 17:16:32 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:17 UTC