FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
2.99k stars 594 forks source link

Allow mobile pinch to zoom of website on carousel. #1021

Closed mi-na-bot closed 2 months ago

mi-na-bot commented 1 year ago

Description

Widgets that disrupt ordinary touch gestures on a mobile device are frustrating. For example, users may want to zoom in on a slide slightly or correct an already zoomed-in state using gestures on top of the carousel component. Unfortunately, the carousel acts as a dead zone, neutralizing the pinch-to-zoom gesture if even one finger of the gesture is inside the component.

This patch causes the carousel to only react to single touch gestures, which is essential so pinch to zoom will not simultaneously drag the slide. It also adds pinch-zoom to the touch-action style, enabling global pinch zooming.

Fixes #1020

Type of Change

How Has This Been Tested?

Connect an iPhone 13 Pro Max to the development web server. Used manual testing for the following:

Ideally, this would include a Cypress test, but I need help figuring out how to simulate compelling touch actions there.

Checklist

vercel[bot] commented 1 year ago

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

Name Status Preview Comments Updated (UTC)
nuka-carousel-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2023 1:42am
leventdeniz commented 1 year ago

@gksander any update on this?

mi-na-bot commented 1 year ago

@leventdeniz I ended up using embla-carousel-react which works alright with pinch zoom. This PR does work as well!

carbonrobot commented 2 months ago

Closing as the code is no longer valid in the new codebase, however, we are using the great tests written here as a baseline to ensure we test this and if needed fix this in v8 as soon as possible.

mi-na-bot commented 2 months ago

@carbonrobot I believe the tests were never finished so I would suggest writing new ones. Nobody seemed particularly interested in the PR for me to waste the time.