| Summary: | REGRESSION?: overflow:hidden on documentElement behaves inconsistently in iOS Safari 15.3.1 | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | ik |
| Component: | Scrolling | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | ik, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 15 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 15 | ||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=199693 https://bugs.webkit.org/show_bug.cgi?id=240859 |
||
|
Description
ik
2022-02-13 05:48:29 PST
For people stumbling across this: My current workaround after a bit of testing and weighing the pros and cons is to detect iOS and force the scrollTop = 0. This is not a solution, however, as it's going to become annoying for users very quickly when the page jumps to the top. The alternative, however, may feel even buggier. Added bonus: Setting scrollbarGutter will prevent layout shifts when the scrollbar dis-/reappears. // Lock if (__isIOS) documentElement.scrollTop = 0; http://documentElement.style.overflow = 'hidden'; http://documentElement.style.scrollbarGutter = 'stable'; // Unlock http://documentElement.style.overflow = ''; http://documentElement.style.scrollbarGutter = ''; We allow scrolling when the visual viewport is smaller than the layout viewport (this is necessary to avoid getting locked in when zoomed), but we allow scrolling to the entire document. Ideally we'd only allow panning around in the layout viewport. scrollbarGutter is not implemented in WebKit so I'm not sure what that has any impact. |