Prevent Body Scrolling (iOS)
See original GitHub issueThere a lot of threads online about how to lock the body especially on iOS, but I haven’t found a good answer.
body { overflow: hidden; } Doesn’t work on iOS.
My question is: how can I prevent Body Scrolling on iOS with react-modal?
Note: I found this package that it might work, but the problem is that I can’t find a way to make it work with react-modal and hooks. React Modal doesn’t accept a ref using useRef
.
https://github.com/willmcpo/body-scroll-lock
Any help?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12
Top Results From Across the Web
How To Prevent Scrolling The Page On iOS Safari 15 - PQINA
If you're browsing this page on iOS Safari, scroll up and down a bit to see the height stays fixed no matter of...
Read more >iOS - css/js - Overlay scroll but prevent body scroll
There is no way around this right now. As of iOS 9.3 there's still no good way to prevent the scroll on the...
Read more >Disable Body Scrolling For Open Modals on iOS Devices
1. Stop everything from scrolling, both body background and everything inside modal. 2. Stop the background from scrolling, while allowing ...
Read more >Preventing body scroll for modals in iOS - Today I Learned
Preventing body scroll for modals in iOS. IOS does not respect overflow: hidden set on body element, and allows for scrolling anyway, which...
Read more >Preventing body scroll for modals in iOS - Ben Frain
iOS doesn't prevent users from scrolling past the modal if there is content that exceeds the viewport height, despite you adding that condition ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Simple solution would be 👍
@Alfrex92 you could try this.