On Mon, 1 Aug 2022 18:42:46 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> The `focusVisible` flag is only set on a node when it acquires input focus >> using a keyboard interaction, and it is cleared by mouse and touch >> interactions. >> >> It is not necessary for a node to lose input focus in order to lose >> `focusVisible`. Currently, clicking on a region of the scene that does not >> contain a focusable node does not clear the `focusVisible` flag. >> >> Detecting clicks or touches that should clear `focusVisible` can be achieved >> by adding an event filter for `MOUSE_PRESSED` and `TOUCH_PRESSED` to the >> `Scene`. >> >> There is an additional noteworthy change with this PR: >> Adding event filters to `Scene` causes many tests to fail due to a bug in >> `MouseEventFirer` that was identified in >> [8253769](https://bugs.openjdk.org/browse/JDK-8253769). Previously, mouse >> events generated by `MouseEventFirer` skipped a code path that causes test >> failures due to incorrect coordinates. With the added event filters, the >> code path for mouse events is slightly different, exposing the incorrect >> coordinates and causing tests to fail. >> This problem can be solved by making the "alternative" `MouseEvent` >> generation path the default path. >> >> Note: Since this is a follow-up fix for >> [8268225](https://bugs.openjdk.org/browse/JDK-8268225), I'm targeting this >> fix for `jfx19`. > > Michael Strauß has updated the pull request incrementally with one additional > commit since the last revision: > > null focus owner never has visible focus Looks good to me. I have identified potential cleanup that may be required. It can be done as part of [JDK-8253769](https://bugs.openjdk.org/browse/JDK-8253769) modules/javafx.controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/MouseEventFirer.java line 63: > 61: this.target = target; > 62: > 63: // Use the alternative creation path for MouseEvent by default, > see JDK-8253769 If the alternative path is made the default then this class needs some cleanup. That can be done as part of `JDK-8253769`. Request you to add a comment in JBS on `JDK-8253769` to clean up the unused portion of `MouseEventFirer.java` ------------- Marked as reviewed by aghaisas (Reviewer). PR: https://git.openjdk.org/jfx/pull/852