Skip to content

iOS: scroll lock should still allow pinch-to-zoom #3602

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

singingwolfboy
Copy link

Some components require scroll-locking for accessibility purposes; however, it seems that on iOS, this scroll locking was going one step too far, and preventing users from being able to use the pinch-to-zoom gesture. Pinch-to-zoom is important, especially for people with low vision conditions; zooming in helps them read and understand the web page.

On iOS, we we are using the touch-action CSS property to disable scrolling around the page. However, instead of setting this property to none to disable all touch interaction, we can set it to pinch-zoom, which should disable all scrolling touch interactions, but still allow the user to zoom in and out as necessary.

I discovered this accessibility issue when trying to use a <Dialog> component from Headless UI. The dialog showed an image, and I wanted to zoom in on the image in order to view it in greater detail, but I discovered that I could not. This change fixes that problem.

Copy link

vercel bot commented Jan 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 1, 2025 11:41am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 1, 2025 11:41am
@Merott
Copy link

Merott commented Apr 14, 2025

I need this too.

The fix appears to be more involved than this, though.

Specifically, it seems like we still need to detect a pinch gesture with JavaScript and return early from the touchmove handler if we do.

See these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants