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

ModalNavigationDrawer gestures easily consume clicks #4748

Open
sproctor opened this issue May 1, 2024 · 2 comments
Open

ModalNavigationDrawer gestures easily consume clicks #4748

sproctor opened this issue May 1, 2024 · 2 comments
Labels
enhancement New feature or request input Touch, mouse, keyboard input related reproduced

Comments

@sproctor
Copy link

sproctor commented May 1, 2024

Describe the bug
Gestures from ModalNavigationDrawer don't make much sense in a desktop environment, but disabling them also disables closing the drawer by clicking on the scrim.

That said, when gestures are enabled any small movement of the mouse is interpreted as a drag instead of a click. I've read that the friction of the mouse is supposed to prevent this, but I have one user who loses approximately 50% of his clicks to this.

I would really like to see either touch slop or something similar applied to mouse movements, or any Material components that have a gesture feature like this have it ignore mouse events. Actually, having ModalNavigationDrawer ignore mouse gestures would make a lot of sense on Android too.

Affected platforms

  • Desktop (Windows, Linux, macOS)

Versions

  • Kotlin version*: 1.9.23
  • Compose Multiplatform version*: 1.6.2
  • OS version(s)* (required for Desktop and iOS issues): Ubuntu 22.04, Windows 10
  • OS architecture (x86 or arm64): x86
  • JDK (for desktop issues): Temurin 17.0.10
@sproctor sproctor added bug Something isn't working submitted labels May 1, 2024
@m-sasha
Copy link
Contributor

m-sasha commented May 2, 2024

Can you be more specific? What is happening that is wrong?
Please provide a code sample and reproduction instructions.

@sproctor
Copy link
Author

sproctor commented May 2, 2024

Typically when you click down on a button, you can move the mouse around on that button and when you release, the onClick handler will be called. When using ModalNavigationDrawer, when you click on a button, if you move the mouse horizontally at all before release, the click will be canceled and interpreted as a drag event by the navigation drawer. I think this is an issue on desktop and Android, but a bigger issue on desktop because it's rare to use a mouse on Android.

https://github.com/sproctor/ComposeDragBug

In this example, you can uncomment the line to disable gestures, which fixes the issue. The problem with that is that then clicking on the scrim doesn't dismiss the drawer.

@igordmn igordmn added input Touch, mouse, keyboard input related reproduced enhancement New feature or request and removed submitted bug Something isn't working labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request input Touch, mouse, keyboard input related reproduced
Projects
None yet
Development

No branches or pull requests

3 participants