dnd
dnd copied to clipboard
Fix: Allow proper cancellation of default browser actions on iOS
This deceptively small commit fixes an issue that most likely have been introduced by the Firefox fix (see line 122).
Current behavior:
On iOS, scroll (at least inside iframes) isn't getting cancelled because the touchmove
is a passive listener. Calling e.preventDefault()
in line 145 doesn't actually do anything.
New behavior
Adding passive: false
makes the listener active, and everything works as intended (scroll is stopped when drag starts). Weirdly enough, the comment in line 120 already suggests this is being done, but...it wasn't 😅
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated |
---|---|---|---|---|
dnd | ✅ Ready (Inspect) | Visit Preview | 💬 Add your feedback | Mar 2, 2023 at 0:36AM (UTC) |
Hello hello! Thanks for the PR! Apologies for not getting to this sooner.
I might be misunderstanding the change here, I'm not seeing a change on iOS using the storybook link. When I drag on iOS 16.3.1 the page continues to scroll with the touch movement.
Note that you can test dnd without the iframe using this link and scrolling appears to work as intended.