I've been searching for a solution to my issue for some time now, and while I've come across many articles discussing similar problems, none of them seem to address my specific problem.
In my React app, I have a mobile version where users can tap on a hamburger menu to open a navigation menu. The navigation menu occupies 80vw and 100vh of the screen. However, users are still able to scroll through the background application by swiping the nav menu for some reason.
Below is the styling for my mobile navigation:
.mobileNav {
height: 100vh;
width: 0vw;
position: fixed;
top: 0;
right: 0;
background-color: #1d1d1d;
z-index: 999;
will-change: transform;
-webkit-transition: 0.75s;
-moz-transition: 0.75s;
-ms-transition: 0.75s;
-o-transition: 0.75s;
transition: width 0.75s;
&--open {
width: 80vw;
}
}
I've attempted setting position: fixed
or overflow: hidden
on the parent element when the navBar is opened to prevent scrolling. However, this action also causes the user to jump back to the top of the page, which is not ideal.
You can view my code on codesandbox here.