Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel press events on scroll #335

Merged
merged 5 commits into from
Apr 1, 2020
Merged

Cancel press events on scroll #335

merged 5 commits into from
Apr 1, 2020

Conversation

devongovett
Copy link
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

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

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