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
GestureDetector should not cancel a tap until finger moves off of button #19783
Comments
I think it's correct that the tap event is canceled if the pointer moves enough. On on the other hand we cancel the splash and press upon tapCancel() and that's not correct. The splash and pending press should only be canceled if the release event occurs outside of the button. https://material.io/design/interaction/gestures.html doesn't appear to provide any guidance about this. There seems to be some variation on exactly how native platforms handle dragging out of a button and then back in again. Android appears to cancel the press on drag-exit and does not restore it upon drag-enter. On IOS the drag-enter restores the button's pressed state. I think we should do the right, platform-form specific, thing here. |
I imagine this happening by having the GestureDetector pass the render object's size to the gesture recognizer when it changes (maybe only for tap). |
@HansMuller it depends how you want to define "correct." Neither Android nor iOS present the behavior you're referring to. Also, as a user, if I press down on a button, and I release anywhere on that button, I expect the button to execute its behavior. You mentioned doing the right per-platform behavior. That sounds good. But I think it's clear that our current behavior isn't correct for either Android or iOS. |
I don't think GestureDetector needs to have the same behavior as buttons and other controls, it's just a simple low level "detector" after all. It's the wrong place for platform specific behavior. |
Looks related to #11385 |
Any update on this, or a workaround? I'm trying to use a |
After going through a bunch of documentations for almost 2 days, I've found using a I put it up here just in case it might help anyone. |
@rahai thanks for mentioning that. I totally forgot about this thread after finding it myself, but I'm sure it will be useful for others in the future. |
When a user taps on a button and then slides his/her finger around the button, if the finger moves more than the "slop" amount, the GestureDetector invokes onTapCancel. This behavior is not desired.
The desired behavior is that as long as the user's finger remains on the button, the button should remain pressed. Only upon dragging off the button should onTapCancel be invoked.
CC @Hixie
The text was updated successfully, but these errors were encountered: