Skip to content

Cancel press events on scroll#335

Merged
dannify merged 5 commits intomasterfrom
press-scroll
Apr 1, 2020
Merged

Cancel press events on scroll#335
dannify merged 5 commits intomasterfrom
press-scroll

Conversation

@devongovett
Copy link
Copy Markdown
Member

When quickly scrolling a selectable list on iOS, sometimes it would close and select an item unexpectedly. This was caused by two issues:

  1. With pointer events, Safari sometimes fires onPointerUp even when the touch isn't within the bounds of the element. This causes our onPressUp event to fire and select the item, closing the menu. It seemed to only happen after a long press before scrolling, or a very quick flick. onPointerCancel is usually fired when scrolling begins though. This is solved by checking if the coordinates of the onPointerUp event are within the bounds of the item.
  2. With touch events, onTouchEnd would still be fired even after scrolling. To fix this, we need to handle onScroll and cancel the press ourselves (pointer events do this by default).

@adobe-bot
Copy link
Copy Markdown

Build successful! 🎉

@adobe-bot
Copy link
Copy Markdown

Build successful! 🎉

@adobe-bot
Copy link
Copy Markdown

Build successful! 🎉

@adobe-bot
Copy link
Copy Markdown

Build successful! 🎉

@adobe-bot
Copy link
Copy Markdown

Build successful! 🎉

@dannify dannify merged commit 566a544 into master Apr 1, 2020
@dannify dannify deleted the press-scroll branch April 1, 2020 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants