Closed Bug 2028308 Opened 5 days ago Closed 2 days ago

Consider suppressing scrollbars that have zero "thickness" in a ::-webkit-scrollbar rule

Categories

(Core :: Layout: Scrolling and Overflow, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: dholbert, Assigned: hiro)

References

(Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:20

Attachments

(3 files, 1 obsolete file)

Attached file testcase 1

See attached testcase. Maybe we should match Chrome in suppressing scrollbars for some of the cases here?

Specifically -- maybe we should suppress all of the scrollbars where the webkit-scrollbar rule gives them zero "thickness"? (horizontal scrollbars that have height: 0 and vertical scrollbars that have width: 0)

This would get us "good" results on WebCompmat Site Report bug 1925937.

Depends on: 1977511

Here's a screenshot comparing us to Chrome.

Notable observations:

  1. Chrome only suppresses scrollbars who have zero "thickness" -- e.g. in Chrome's rendering of the first part of the testcase (top-right portion of my screenshot), the width:0 suppresses the vertical scrollbar, whereas the horizontal scrollbar simply stops painting (but still occupies the regular amount of blank layout space for the scrollbar- track) -- presumably it's blank because I didn't provide styles for how to paint it.
  2. So in Chrome, the third part of this testcase -- the part with width:0; height:0 -- is essentially equivalent to scrollbar-width:none. The first and second part are a bit more subtle because they only zero out one scrollbar.
  3. Firefox Nightly matches Chrome on the fourth part of this testcase (thanks to bug 1977511), and we match Chrome on the fifth part of this testcase because it's using the standard styles.

The gazetasp.com.br site in bug 1925937 uses styles like the third part of my testcase (specifying both width:0 and height:0).

If we suspect other sites might be doing the same thing with a similar scrollbar-hiding intent, we might consider special-casing ::-webkit-scrollbar { width: 0; height: 0; } as behaving like scrollbar-width: none. (Where sites might use e.g. "0px" etc instead of literal 0.)

(We might also try to get the single-axis-collapsing from the first and second part of my testcase -- but as of now, we don't have any confirmation that sites actually do that, so maybe that's something to not worry about until we have a demonstration that it's needed.)

hiro, what do you think? Do you have cycles to craft a followup along those lines? (As of now I only know of one WebCompat Site Report that would benefit from this, so maybe not a high reward, but also perhaps pretty low-cost as well, since I imagine a lot of the supporting pieces are now already there.)

Flags: needinfo?(hikezoe.birchill)

webkit-scrollbar-zero-width-and-height.html: Tests that setting both width
and height to 0 on ::-webkit-scrollbar hides the scrollbars, matching the
display:none behavior.

webkit-scrollbar-zero-width-and-height-scrollbar-width-thin.html: Tests that
a non-auto scrollbar-width (thin) clobbers the width:0/height:0 hiding, so
scrollbars remain visible.

I did instruct Claude Code to write D291361 step by step, so that it reflects my preferences, e.g. I don't want to use std::pair of bool. Anyways, if there's any mistake, it's my fault. Indeed now I realized I forgot adding the reviewer. :)

Flags: needinfo?(hikezoe.birchill)
Assignee: nobody → hikezoe.birchill
Attachment #9562460 - Attachment description: WIP: Bug 2028308 - Hide scrollbars when ::-webkit-scrollbar has width:0 and height:0. → Bug 2028308 - Hide scrollbars when ::-webkit-scrollbar has width:0 and height:0. r?#layout-reviewers
Status: NEW → ASSIGNED

webkit-scrollbar-zero-width-and-height.html: Tests that setting both width
and height to 0 on ::-webkit-scrollbar hides the scrollbars, matching the
display:none behavior.

webkit-scrollbar-zero-width-and-height-scrollbar-width-thin.html: Tests that
a non-auto scrollbar-width (thin) clobbers the width:0/height:0 hiding, so
scrollbars remain visible.

webkit-scrollbar-percent-width-height.html: Updated to only set one dimension
per test case (width-only or height-only), since setting both to percent values
would now trigger the width:0/height:0 hiding behavior (percent is treated as 0
on Blink/WebKit).

Attachment #9562463 - Attachment description: WIP: Bug 2028308 - Hide scrollbars when ::-webkit-scrollbar has width:0 and height:0. → Bug 2028308 - Hide scrollbars when ::-webkit-scrollbar has width:0 and height:0. r?#layout-reviewers

There was another mistake by me! I was being ignorant about the initial value of width/height style.

And I don't know what happened. there remained a previous version of the patch. I am going to abandon it.

Attachment #9562460 - Attachment is obsolete: true
User Story: (updated)
Status: ASSIGNED → RESOLVED
Closed: 2 days ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: