-
Notifications
You must be signed in to change notification settings - Fork 820
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
[Dialog] Unable to pinch zoom using trackpad #1554
Comments
Able to reproduce this using the Context Menu component in |
Is there already a solution to this problem? |
Hi @chesterhow, Yeah this is strange, we specifically enabled pinchZooming on
We made this change in this PR: #1514 for exactly the reasons you are talking about. Unfortunately, if the fix is not made upstream, there isn't much we can do at the moment. We did experiment with ditching I would suggest you all continue working with the upstream library to push for a fix which we can then integrate. 🙏 |
I just ran into this today, the way I got it working is a bit hacky:
Note: since the state changes asynchronously I put the if statement with a "counter-intuitive" condition before applying |
I use pnpm, so I can use overrides and pnpm patch to resolve the issue by patch It is a neat resolution that everyone can take without breaking structures of dependencies.
{
...
"resolutions": {
"react-remove-scroll": "2.5.7"
}
}
and change this condition to if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {
...
} This is because it dose not support pinch zoom action on magic track pad, which event is wheel + ctrlKey now you can pinch and zoom on the dialog. |
A related problem is that this disables other gestures like swipe back, so if you, for instance, have a route that is opened in a dialog, that breaks the gesture for back. |
Thank you for your solution! Therefore, this issue should be solved if the package.json of radix-ui can be updated. |
Is this fixed with react-remove-scroll version 2.6.0? I updated to test but swipes still don't work. I want to enable swipe back whilst dialog is open, but I couldn't find a solution for days. |
@borabaloglu Yeah, unfortunately the swipes don't work with this update. |
Bug report
Congrats on the 1.0 release! I see that the
allowPinchZoom
prop has been removed and now defaults totrue
. However, there is still an issue with pinch zooming: it is not supported on trackpads.I understand that
allowPinchZoom
is a prop for the underlyingreact-remove-scroll
library, and I filed an issue with them a couple of weeks back (theKashey/react-remove-scroll#75). The maintainer has acknowledged the issue but it doesn't seem like there will be a fix anytime soon.Current Behavior
When a dialog is open (or any primitive that uses
react-remove-scroll
), I am unable to pinch-and-zoom the webpage using the trackpad.Expected behavior
I should still be able to pinch-and-zoom using the webpage when the dialog is open.
Reproducible example
This is reproducible in the dialog example in the Radix docs: https://www.radix-ui.com/docs/primitives/components/dialog
Additional context
I am using Dialog to render a full-screen modal of sorts which displays an image. An expected common behavior here would be that I am able to pinch-and-zoom on the image.
The text was updated successfully, but these errors were encountered: