-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overlay: Investigate ways of blocking body scroll #1662
Comments
This is one of those things that simply do not have the perfect way of doing it. :) I say go with whatever "works" in material1, potentially change later. |
Hi @crisbeto |
@crisbeto Would option 2 cause double scrollbars? One nice property about the material1 method is that if you have a sidenav and lock scrolling on the body(or equivalent content area) you do not end up with 2 scrollbars showing at once if your sidenav is tall. |
Option 2 is purely JS and can't cause multiple scrollbars @epelc, but it's not guaranteed that it'll block scrolling in all cases. |
Adds a `DisableBodyScroll` injectable that can toggle whether the body is scrollable. Fixes angular#1662.
Adds a `DisableBodyScroll` injectable that can toggle whether the body is scrollable. Fixes angular#1662.
any news? |
There's a pending PR, it just isn't merged yet. |
Adds a `DisableBodyScroll` injectable that can toggle whether the body is scrollable. Fixes angular#1662.
Adds a `DisableBodyScroll` injectable that can toggle whether the body is scrollable. Fixes angular#1662.
Adds a `DisableBodyScroll` injectable that can toggle whether the body is scrollable. Fixes angular#1662.
friendly ping :) |
This is in master now and will be part of the next release. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
We need a way of blocking body scroll when something like a dialog is open. There are a few ways this can be done:
position: fixed
on thebody
and we offset the scroll position. This approach is pretty reliable, but can have unexpected consequences.preventDefault
on touch, keyboard and mousewheel events, as well as saving the scroll position and resetting it in a scroll handler. Mostly works, but can still cause jumping in certain browsers.overflow: hidden
on thebody
and addingpadding-left
with the size of the scrollbar to prevent content jumping. May be tricky to determine the scrollbar width. Can also conflict with user styling.I'm open to more suggestions since none of these solutions are perfect.
Related to #1633.
The text was updated successfully, but these errors were encountered: