From ab73e1ab36a460a1678842d906b43d10b01c8d3d Mon Sep 17 00:00:00 2001 From: Tom Dohnal Date: Fri, 16 Aug 2024 13:56:39 +0100 Subject: [PATCH 1/2] allow zooming --- packages/@react-aria/overlays/src/usePreventScroll.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/@react-aria/overlays/src/usePreventScroll.ts b/packages/@react-aria/overlays/src/usePreventScroll.ts index ad4f4cdd74e..4aa5cea6c3a 100644 --- a/packages/@react-aria/overlays/src/usePreventScroll.ts +++ b/packages/@react-aria/overlays/src/usePreventScroll.ts @@ -123,6 +123,13 @@ function preventScrollMobileSafari() { }; let onTouchMove = (e: TouchEvent) => { + if (e.touches.length === 2) { + // If there are two touch points, the user is likely trying to zoom. As we + // don't want to prevent pinch zooming by calling `e.preventDefault()`, + // we return early here. + return + } + // Prevent scrolling the window. if (!scrollable || scrollable === document.documentElement || scrollable === document.body) { e.preventDefault(); From 65f219e72b673de6accc607bdb0ae01960f8966f Mon Sep 17 00:00:00 2001 From: Robert Snow Date: Tue, 10 Sep 2024 08:44:04 +1000 Subject: [PATCH 2/2] fix lint --- packages/@react-aria/overlays/src/usePreventScroll.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-aria/overlays/src/usePreventScroll.ts b/packages/@react-aria/overlays/src/usePreventScroll.ts index 4aa5cea6c3a..35f5e8753c7 100644 --- a/packages/@react-aria/overlays/src/usePreventScroll.ts +++ b/packages/@react-aria/overlays/src/usePreventScroll.ts @@ -127,7 +127,7 @@ function preventScrollMobileSafari() { // If there are two touch points, the user is likely trying to zoom. As we // don't want to prevent pinch zooming by calling `e.preventDefault()`, // we return early here. - return + return; } // Prevent scrolling the window.