A dead-lock is caused by the interaction of MacOS, the AWTEventQueue and JavaFX when the users pressed the Caps Lock key while the AWTEventQueue is processing another event (more on this in the issue). The bug depends on the specific timing of the event sending and can apparently be prevented by finishing all incoming OS events directly while the LWCToolkit.invokeAndWait method is executed.
This fix is tested and fixes the issue. I attached a small [reproducer](https://github.com/openjdk/jdk/files/13751865/Archive.zip), just run it with `mvn install package javafx:run`. ------------- Commit messages: - Fix bug Changes: https://git.openjdk.org/jdk/pull/17184/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17184&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8221261 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/17184.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17184/head:pull/17184 PR: https://git.openjdk.org/jdk/pull/17184