Focused nodes and focus owners
Andy Goryachev
andy.goryachev at oracle.com
Fri Aug 18 16:55:24 UTC 2023
Michael:
Is there a specific problem that absolutely cannot be solved without adding extra properties to Node (or Control)?
Thanks!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Michael Strauß <michaelstrau2 at gmail.com>
Date: Friday, August 18, 2023 at 09:35
To: openjfx-dev <openjfx-dev at openjdk.org>
Subject: Focused nodes and focus owners
Scene graph nodes have three focus-related properties:
1. focused
2. focus-within
3. focus-visible
What might be a bit surprising is that multiple nodes can be focused
at the same time, but only one of those focused nodes can be the
scene's focus owner. The `Scene.focusOwner` property indicates which
of the focused nodes is the current focus owner.
Even more surprisingly, a node can be _unfocused_ and be the focus
owner at the same time (this can happen when the window is
deactivated).
>From the perspective of `Node`, there's currently no API to easily
determine whether it is the focus owner, and there's no CSS
pseudo-class that matches a node that is the focus owner.
We could add two more properties to the `Node` class to support this use case:
4. focus-owner
5. focus-owner-within
Note that `focus-visible` only matches nodes that are also focus
owners, so there's no need to have a `focus-owner-visible` property.
The two additional properties would suffice to match any possible
focus state, but it might also be not useful enough to warrant the
additional API surface. What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230818/4002ccc1/attachment.htm>
More information about the openjfx-dev
mailing list