Re: [csswg-drafts] [css-overflow-4] scrollbar-gutter is too complex (#4674)

Indeed, I've found this property incredibly confusing every time I've looked into it (multiple times in the last few weeks). I can't even hold what the values do in my head long enough to finish reading the docs, which is a pretty bad sign.

Trying to introspect a bit more about what makes it so hard to learn, these are my raw thoughts:

- `stable` has no obvious meaning. I can think of many possible things that `scrollbar-gutter: stable` can plausibly do, and what it actually does is only one of them and it seems arbitrarily chosen. The same thing could have been expressed via `always` and it would have been no more surprising.
- `always` means always, except when it doesn't, and then you need `force` to get it to *really* mean `always`...
- `both` looks like it makes whatever the rest of the values means apply to both directions, which begs the question what direction is specified without it, and how to set `scrollbar-gutter` values that are different for X and Y.
- No combination of keywords seems to be able to specify the default behavior, which is just ...`auto`. `auto` should be possible to express through the property's syntax, which would make it easier for authors to tweak the default behavior by adding or removing parameters, whereas `auto` cannot be combined with anything else.

Ignoring `both` for a moment, I think the primary problem here is that we have a set of 4 distinct values to express a combination of parameters that, if specified independently, would produce far more than 4 combinations.   Therefore each of these values sets a number of parameters, which often seems rather arbitrary, making its syntax hard to internalize.

It seems that the actual thing this is trying to control is:
1. Is a gutter present with classic scrollbars?
 - If yes: Is a gutter present with overlay scrollbars as well? 
2. Is a gutter present when content is not overflowing?
3. Is a gutter present when `overflow` is `scroll`/`auto`?
 - If yes: Is a gutter present when `overflow` is `visible`/`hidden`/`clip` as well?

I think we may be seeing the same design mistake that was made with `display` or `position`.
I wonder if we can reach a more explicit syntax where each orthogonal decision is obvious instead of "packaged" behind a keyword. Also for 3, why do we need to account for this? Can't whoever sets this also set `overflow` accordingly?



-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4674#issuecomment-831951656 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 4 May 2021 13:42:20 UTC