diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 8e8f683446..b396461700 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix enter transitions in `Transition` component ([#3074](https://github.com/tailwindlabs/headlessui/pull/3074)) - Fix focus handling in `ListboxOptions` and `MenuItems` components ([#3112](https://github.com/tailwindlabs/headlessui/pull/3112)) - Fix horizontal scrolling inside the `Dialog` component ([#2889](https://github.com/tailwindlabs/headlessui/pull/2889)) +- Don’t cancel `touchmove` on `input` elements inside a dialog ([#3166](https://github.com/tailwindlabs/headlessui/pull/3166)) ### Changed diff --git a/packages/@headlessui-react/src/hooks/document-overflow/handle-ios-locking.ts b/packages/@headlessui-react/src/hooks/document-overflow/handle-ios-locking.ts index c8228e3168..3a70893e8f 100644 --- a/packages/@headlessui-react/src/hooks/document-overflow/handle-ios-locking.ts +++ b/packages/@headlessui-react/src/hooks/document-overflow/handle-ios-locking.ts @@ -94,6 +94,12 @@ export function handleIOSLocking(): ScrollLockStep { (e) => { // Check if we are scrolling inside any of the allowed containers, if not let's cancel the event! if (e.target instanceof HTMLElement) { + // Some inputs like `` use touch events to + // allow interaction. We should not prevent this event. + if (e.target.tagName === 'INPUT') { + return + } + if (inAllowedContainer(e.target as HTMLElement)) { // Even if we are in an allowed container, on iOS the main page can still scroll, we // have to make sure that we `event.preventDefault()` this event to prevent that. diff --git a/packages/@headlessui-vue/src/hooks/document-overflow/handle-ios-locking.ts b/packages/@headlessui-vue/src/hooks/document-overflow/handle-ios-locking.ts index a19966a7f6..de139c19f8 100644 --- a/packages/@headlessui-vue/src/hooks/document-overflow/handle-ios-locking.ts +++ b/packages/@headlessui-vue/src/hooks/document-overflow/handle-ios-locking.ts @@ -94,6 +94,12 @@ export function handleIOSLocking(): ScrollLockStep { (e) => { // Check if we are scrolling inside any of the allowed containers, if not let's cancel the event! if (e.target instanceof HTMLElement) { + // Some inputs like `` use touch events to + // allow interaction. We should not prevent this event. + if (e.target.tagName === 'INPUT') { + return + } + if (inAllowedContainer(e.target as HTMLElement)) { // Even if we are in an allowed container, on iOS the main page can still scroll, we // have to make sure that we `event.preventDefault()` this event to prevent that.