Wrapped Page Is Still Scrollable
See original GitHub issueCurrently with an implementation like the following: App:
<div id="outer-container" className="forecast-page-container">
<Menu
pageWrapId={'page-wrap'}
outerContainerId={'outer-container'}
options={this.regions}
{...this.props}
/>
<div id="page-wrap" className={'forecast-page full-width'}>
<Navbar />
<ForecastPage {...this.props} />
</div>
</div>
Menu:
<ReduxBurgerMenu
pageWrapId={this.props.pageWrapId}
outerContainerId={this.props.outerContainerId}
isOpen={this.props.burgerMenu.isOpen}
right
customBurgerIcon={false}
>
.... Some items in the menu
</ReduxBurgerMenu>
When the menu is open I am still able to scroll the page-wrap div element. Since I have a list of items in my menu, and it is scrollable this creates a really weird interaction.
Is there any way to lock the scrolling on the page-wrap item.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Body set to overflow-y:hidden but page is still scrollable in ...
Scroll works fine in the inner container, but the event doesn't propagate to the body and so it does not scroll. This is...
Read more >How to prevent overflow scrolling in CSS - LogRocket Blog
What causes the overflow scroll issue? Max viewport width; CSS grid; Not wrapping with Flexbox; Using images without max-width.
Read more >overscroll-behavior - CSS: Cascading Style Sheets | MDN
If you have overscroll-behavior: contain; selected, the outer container will not scroll unless you move your cursor out of the inner ...
Read more >Overflow Issues In CSS - Smashing Magazine
The first way to discover an overflow issue is by scrolling the page horizontally. If you're able to scroll, this is a warning...
Read more >Scrollable Page with Shrink Wrapped ListView
I'm still a little uncertain on the exact differentiation between 'primary' (scrolling) widgets and non-primary - as well as the exact usecase here...
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
Thanks to @monsonjeremy’s suggestion, I followed the same approach, since I wasn’t able to get any of the other suggestions to work.
In case anyone finds value, here’s my code snippet:
Thanks for the reply @negomi, I ended up finding a workaround by checking the state of the menu and if it is open I set the Document Body style to have
overflow: hidden
.This seems like a hacky workaround, but for some reason setting overflow: hidden on the page wrap element wasn’t doing it. I have the overlay as well so i’m not sure why.
Here are the relevant files if you want to take a look:
Component where I put items in the menu: https://github.com/monsonjeremy/Forecast-Me/blob/master/client/src/components/SpotSelectDrawer.jsx
Container where i do the page-wrap: https://github.com/monsonjeremy/Forecast-Me/blob/master/client/src/containers/ForecastPageContainer.jsx
ReduxBurgerMenu container: https://github.com/monsonjeremy/Forecast-Me/blob/master/client/src/containers/ReduxBurgerMenu.jsx