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

make sure cancelable is true before calling onPress for touchEnd event #1252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dlgski
Copy link

@dlgski dlgski commented Dec 7, 2020

Issue #1251

When you have buttons within a ScrollView, and on a Chromebook you press on one of those buttons and drag your finger up or down to scroll. It should not trigger the onPress event.

What is currently happening is the press event is triggered and an Intervention warning is displayed in the console:

[Intervention] Ignored attempt to cancel a touchend event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

What needs to done to fix this is to make sure onTouchEnd the event is cancelable before triggering the onPress event actions.

This PR simply adds this check.

Copy link
Contributor

@fbartho fbartho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only resolves the console warning, right? There's no user-visible behavior changes other than that?

@dlgski
Copy link
Author

dlgski commented Dec 7, 2020

It fixes the conflict of scrolling and pressing on a button at the same time. So if you press & scroll the press action should not occur. Currently the press action does happen and this Intervention warning happens. With this in place, the press action will be suppressed if you are scrolling and no Intervention warning is displayed.

This occurs on a touchscreen device like a Chromebook.

ref: https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable

Event listeners that handle multiple kinds of events may want to check cancelable before invoking their preventDefault() methods.

@dlgski
Copy link
Author

dlgski commented Jan 5, 2021

hi @fbartho do you need anything more for this PR? Is there a plan to get it merged? ty!

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.

None yet

3 participants