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:
Desktop
Versions
Kotlin version*: 1.9.10
Compose Multiplatform version*: 1.5.3
OS version(s)* (required for Desktop and iOS issues): Mac OS Ventura 13.5.2 (22G91)
OS architecture (x86 or arm64): arm
JDK (for desktop issues): azul 15.0.8
To Reproduce
Steps and/or the code snippet to reproduce the behavior:
Click button, see file picker dialog open.
Press Enter.
See file picker re-appear because Pick file was "clicked".
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:
Enter
.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