-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Enable TapRegion to detect all mouse button click #136799
Conversation
…et/flutter into feature/tapregion-136706
This doesn't look right, since it changes the behavior of |
@dkwingsmt The documentation of both /// A render object that provides notification of a tap inside or outside of a
/// set of registered regions, without participating in the [gesture
/// disambiguation](https://flutter.dev/gestures/#gesture-disambiguation)
/// system. Here the keyword is - without participating in the gesture disambiguation. As I understood, the responsibility of these 2 widgets is not to detect and identify gestures or taps, but just to notify if a tap happens inside or outside of a specific region. So does it make sense to differentiate between mouse button taps? Moreover, if the app developer wants to identify which mouse button has triggered the tap event, he/she can get the details from the |
Hi @dkwingsmt, I am waiting to hear your thoughts on this. |
I think the change of design makes sense, although I'd like to hear @gspencergoog's thoughts, since he wrote both the code and the doc. I'm not in favor of the way you change the unit tests. I think the better way is to keep the current test cases as much as possible, and add new test cases, even if it's just copy pasting the majority of the one for the primary button (but usually you can skip some of the details). This avoids braiding multiple features into one (so that it's hard to find errors if it is broken) and avoids a test case going too long. |
Thanks @dkwingsmt for your input. I'll make changes to the test cases as suggested once @gspencergoog confirms the code changes. |
This is not a bad idea, but the problem I see is that it will subtly break developer's code. It widens the allowed set of pointers to all pointers, which means that secondary clicking inside or outside will now also do whatever primary clicking did. I can see the argument that this is the right thing to do anyhow, since The non-breaking alternative is to create new optional callback(s) that provide information for other pointers, but that seems like an overly complicated API, and it complicates the implementation too. Overall, I think I'm probably OK with the change as-is (well, I'd also like to see the testing changes Tong suggested), but if there were a way to make it less "stealth" of a break without complicating the API too much, then I'd prefer that (I can't think of one at the moment, though). |
Usually we'd solve this by renaming symbols. What about creating a new method such as |
@dkwingsmt Then again, you have to deprecate |
@anidotnet Can you change this PR so that instead of changing the behavior of @gspencergoog What do you think? |
@dkwingsmt there is another problem with this approach. There are other built-in widgets which are using Let's say you are using it to show a context menu, you right click, it opens the menu. If you right click to another region, it will open another menu without closing the earlier one. Which is a weird behavior for a context menu in a desktop app, isn't it? How do you plan to fix these? |
We can declare these behaviors as bugs and directly change these built-in widgets' use of |
Upon a quick review, here are the built-in widgets that either uses
Among them
So there also we have to introduce I am wondering is this tedious process worth all the trouble? Instead, can we not change the behavior of |
Flutter has been doing this "tedious process", and much more than what we've talked about here, since the beginning. Because as a library, Flutter promised backward compatibility, and maintaining this backward compatibility builds trust. Developers expect that what worked in earlier version continue to work in newer versions. Your apps have also benefitted from this for many times. |
Understood. So how do you want to handle the changes for each widget? In the current PR only or separate issue+PR for each widget? I want to bring to your notice that I may not have bandwidth to work on all these changes. I can't guarantee on the timeline, but a helping hand would make things faster. |
I talked with gspencergoog offline and we agreed that we can make the change in-place (i.e. as the current PR). Since the document has long stated that this widget detects all pointer down events without considering buttons, this change can be considered a bug fix instead of a breaking change. If you make the test changes (as suggested above), we can get this PR merged. :) Thanks for your contribution. |
No, we'll just modify the behavior or |
@dkwingsmt I have updated the test cases. Sorry for the delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sorry for the late review!
@dkwingsmt Thanks a lot. Now should I merge this PR or somebody else will do it? |
With this PR, TapRegion would be able to detect any kind of mouse button events. Earlier, TapRegion used to detect only left mouse button event.
Fixes #136706
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.