Skip to content
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

Scroll lock prevents multi-touch zoom and back functionality #49

Closed
ShaneHudson opened this issue Feb 11, 2021 · 6 comments
Closed

Scroll lock prevents multi-touch zoom and back functionality #49

ShaneHudson opened this issue Feb 11, 2021 · 6 comments
Assignees
Labels

Comments

@ShaneHudson
Copy link

ShaneHudson commented Feb 11, 2021

Hi there, thanks for making this package it's really handled a lot of the situations I was manually catering for.

One issue I have with it is that I want scroll lock enabled, to prevent the page behind a modal scrolling, but I also want multi-touch zoom and swipe to go back to work. Is there currently any flags that will allow this while maintaining the scroll-lock for the rest of the page?

I have a modal inside a Portal if that's relevant to it.

@theKashey
Copy link
Owner

Generally, you are looking for the allowPinchZoom option. Please give it a try and check if it's working for you.
It might not work that well, and I don't have a better solution here.

You might not need the actual logic behind remove-scroll part, but only remove-scroll-bar - historically this code was created to handle Safary, and right now the newer versions can "scroll-lock" with a simple overflow on the body.
So can you try as well just skip extra logic:

@ShaneHudson
Copy link
Author

Thanks @theKashey, I can confirm that disabling scrollLock and using the package manually did do the job nicely. Thanks!

@equinusocio
Copy link

Thanks @theKashey, I can confirm that disabling scrollLock and using the package manually did do the job nicely. Thanks!

Doesn't seems a solution...

@cee-chen
Copy link
Contributor

Just wanted to add a +1 that @theKashey's suggestion (forcing scrollLock={false} and including <RemoveScrollBar /> manually) worked perfectly for us. In our use-case, we didn't need pinch/zoom behavior - but we had popovers/dropdown menus within our focus-trapped modals/flyouts that were portalled at the top level of the document, and those dynamic portals needed to be scrollable.

One small thought:

historically this code was created to handle Safari, and right now the newer versions can "scroll-lock" with a simple overflow on the body.

Since Safari no longer has this issue, could you consider removing this extra behavior from scrollLock by default or allowing it to be configurable by a prop, e.g. scrollLock="cssOnly" or similar? We're fine with this workaround for now, but just throwing this out there as the scroll prevention feels like it's causing more issues at this point than solving them.

@theKashey
Copy link
Owner

@cee-chen+++:

Time changes, so should we

@stale
Copy link

stale bot commented Jun 28, 2023

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.

@stale stale bot added the state label Jun 28, 2023
@stale stale bot closed this as completed Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants