RFR: 8313956: focusWithin on parents of a newly-added focused node is not updated [v2]

Michael Strauß mstrauss at openjdk.org
Fri Aug 18 13:41:34 UTC 2023


On Thu, 17 Aug 2023 00:30:45 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> This PR fixes an issue with the way `focusWithin` bits are adjusted in the scene graph. Previously, the `focusWithin` counts of all parents of a removed node would be decreased if the removed node has a non-zero `focusWithin` count. This PR adds logic for the opposite scenario: the `focusWithin` count is increased on all parents of a newly-added node that is already focused (or contains other focused nodes).
>
> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removed unnecessary code

> One thing I noticed in the example in the ticket now: When I click the button below the `TableView`, the `focusWithin` is still 1. 
> It seems like the `focusWithin` count is always 2 when the `TableView` is selected. When clicking the button, it will go down to 1, but not 0.

That's because the table row remains `focused` even if you change the scene's focus owner to the "focus lost" button.
Maybe we need a `Node.focusOwner` property, and an associated `focus-owner` pseudo-class that would enable applications to match the scene's focus owner.

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

PR Comment: https://git.openjdk.org/jfx/pull/1210#issuecomment-1683936227


More information about the openjfx-dev mailing list