> On Oct 7, 2023, at 2:00 PM, Michael Strauß <[email protected]> wrote:
>
> JavaFX has two closely related focus concepts: `Node.focused`, which
> can apply to any number of nodes in a scene graph, and
> `Scene.focusOwner`, which is the single node in a scene graph that
> accepts user input.
The current JavaDoc for Node.focused is straight-forward and intuitive.
Indicates whether this Node currently has the input focus.
To have the input focus, a node must be the Scene's focus
owner, and the scene must be in a Stage that is visible
and active.
The way TableView is using this property violates all of these criteria.
The proposed focusOwner property is not a replacement because it only meets one
of these criteria; a node can be the focusOwner on a stage that is not active
in which case it doesn’t actually have the input focus (but it will when the
stage is activated). So the proposed focus-owner-within pseudo-class will apply
even in windows that aren’t active. It might have it’s uses but it’s not a
replacement for focus-within and won’t address the issue in the original bug
report.
I think JDK-8317426 should be re-opened. The current implementation of
Node.focused is out-of-spec so everything downstream from it (including
focus-within) is out-of-spec. But the real issue is that the behavior of
Node.focused is utterly unintuitive.
Put another way, if we were to leave the implementation as-is and just update
the Node.focused JavaDoc what would the new wording be?