Is there a bug with scrollbar-width css property in Chrome 121?

62 Views Asked by At
body::-webkit-scrollbar { /* Chrome and Edge (Webkit or Blink) */
    display: none;
}
body {       
    -ms-overflow-style: none; /* IE and legacy Edge */
    scrollbar-width: none; /* Firefox */
}

These styles are for hidding the scrollbar while allowing the user to scroll the content by other means, for example by the mouse wheel.

These styles worked in versions of Chrome, but not anymore in version 121. But see, if I comment out the scrollbar-width property line, then the scrollbar is hidden again in Chrome 121.

This property used to do nothing in Chrome prior to version 121, because it wasn't implemented, but now, it seems to be conflicting with ::-webkit-scrollbar { display: none; }.

Also scrollbar-width: none is neither hiding the scrollbar in Chrome 121, as it should since this version?

Chrome version: 122.0.6261.58 (Build oficial) (64 bits)

Workaround/solution:

This little tweak in the styles solves the problem:

body::-webkit-scrollbar { /* Chrome and Edge (Webkit or Blink) */
    display: none;
}
body {       
    -ms-overflow-style: none; /* IE and legacy Edge */
}
@-moz-document url-prefix() { /* === Added this wrapper === */
    body {       
        scrollbar-width: none; /* Firefox */
    }
}

The question still remains, is there a bug?

0

There are 0 best solutions below