compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

ModalNavigationDrawer gestures easily consume clicks

Open sproctor opened this issue 1 year ago • 2 comments

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 avatar May 01 '24 23:05 sproctor

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

m-sasha avatar May 02 '24 12:05 m-sasha

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.

sproctor avatar May 02 '24 13:05 sproctor

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov