Do Not Blindly Set scrollbar-gutter: stable

I would like to bring attention to a concerning trend on the web over the past few months. From what I assume to be LLMs regurgitating nonsense about how amazing the scrollbar-gutter CSS property is, many of them fail to mention a major drawback that must be addressed if you display embedded content on your site.

You see, when you apply this property to your site on the html element it completely overrides the entire document, including embeds. This is made worse if you include the both-sides property which will add padding to both edges of the screen. So, what happens if I wanted to watch a YouTube video embed in full screen while this property is applied? This:

Notice something? There are black bars to the right, top and bottom of the screen for no reason when I am watching this YouTube embed. Not a very good experience. It causes suboptimal resolution scaling against my display size by forcing a downscale filter. So for example, I have a 1440p monitor and yet if I set this video to 1440p, it isn’t actually taking up the entire screen so its forced to down sample ever so slightly which ruins pixel perfect detail. Even if you don’t care about all that, it looks ugly.

You may be thinking:

Oh, this is probably some random website which didn’t test this before applying the property.

WRONG. This is, google.com. If you expand any video on a browser that displays fixed scroll bars while doing a Google search, this will happen to you. So anytime I want to watch a video in full screen from an embed because its short (like a tutorial), I have to deal with this. How do you fix it? That’s right! You just remove the scrollbar-gutter property from the html element and it goes away.

If Google wants to actually keep the nice stable looking scrollbar gutter but not screw up any embed that goes full screen, they need to programmatically control when that property is applied and disable it when an iFrame goes full screen.

Rant over.

Leave a Reply

Your email address will not be published. Required fields are marked *