79787488

Date: 2025-10-10 15:26:59
Score: 0.5
Natty:
Report link

The answer by Alohci is mostly correct, but here is some clarification that I needed when working through this.

If you want to add overflow: hidden on the body tag, but you want the scrollbar gutter to be applied, all you need to do is to apply scrollbar-gutter to the html tag.

.html {
   scrollbar-gutter: stable;
}

.body {
   overflow: hidden;
}

(Alohci's answer had overflow: hidden on the html tag and that's not necessary, or applies to what the OP was asking.)

In our case, we are setting the overflow: hidden to the body tag via JavaScript when an event is triggered.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Eric