On Thu, 28 Jul 2022 14:59:06 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`.

This pull request has now been integrated.

Changeset: 5febacae
Author:    Michael Strauß <mstra...@openjdk.org>
URL:       
https://git.openjdk.org/jfx/commit/5febacae1bf6776a31e151ef223739576dab67e6
Stats:     87 lines in 3 files changed: 82 ins; 1 del; 4 mod

8291502: Mouse or touch presses on a non-focusable region don't clear the 
focusVisible flag of the current focus owner

Reviewed-by: kcr, aghaisas

-------------

PR: https://git.openjdk.org/jfx/pull/852

Reply via email to