Entry 05
No rubber-band bounce on desktop
Use it on app-like pages with fixed UI, such as a sidebar or a sticky header. On macOS a trackpad scroll stretches the whole page past its edge and drags the fixed UI along.
Code
html { overscroll-behavior-y: none; }
@media (any-pointer: coarse) {
html { overscroll-behavior-y: auto; }
}Why it works, the rules and the credits
Why it works
overscroll-behavior-y: noneon the root turns off the bounce.- Touch devices get the default back, because pull to refresh depends on it.
any-pointerchecks every input, wherepointerchecks only the primary one. A device with a touchscreen plus a mouse or stylus keeps pull to refresh. Jhey's example is a foldable.
Rules
- Set it on
html. The viewport takes its overscroll behavior from the root element. - Use the
-ylonghand.overscroll-behavior-x: nonealso turns off swipe to go back. - Give inner scroll containers, such as a sheet, a chat list or a sidebar,
overscroll-behavior: contain. They keep their own bounce and stop the page behind them from moving. Never use atouchmovelistener withpreventDefault()for this.
Credits
Borrowed from: wits, @witsdev on X, 2026-09-30, describing how Vercel gates it behind pointer: fine · Jhey Tompkins, @jh3yy on X, for the any-pointer version · Emil Kowalski, mobile-native skill, for the inner containers