JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.9k stars 1.16k forks source link

Closing Awt file dialog by pressing Enter triggers previously focused button's on click #3892

Open alex-vit opened 10 months ago

alex-vit commented 10 months ago

Describe the bug

In a Composable with a button that opens an Awt file picker, closing the dialog by pressing Enter or double-clicking a file (anything but clicking the dialog's native "Cancel" / "Save" / "Open" buttons), also triggers the focused button's on click, re-opening the file picker dialog immediately.

Workaround is to clear focus manually. See code gist.

Affected platforms Select one of the platforms below:

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Click button, see file picker dialog open.
  2. Press Enter.
  3. See file picker re-appear because Pick file was "clicked".

Code gist.

Expected behavior File picker closed. No phantom clicks. (Move focus to Awt window?)

Screenshots Notice key-presses in the bottom left.

https://youtu.be/_I0y_oUKAOk

eymar commented 10 months ago

Reproduced on macos. 1.5.10 affected too. Not reproducible on Ubuntu.

okushnikov commented 2 weeks ago

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