On Mon, 28 Oct 2024 17:33:46 GMT, Andy Goryachev <[email protected]> wrote:
>> Because `focusVisible` is specified to _only_ be set as a result of keyboard
>> navigation, not as a result of programmatic navigation.
>>
>> `Node.focusVisible` specifies:
>>
>> /**
>> * Indicates whether this {@code Node} should visibly indicate focus.
>> * This flag is set when the node acquires input focus via keyboard
>> navigation,
>> * and it is cleared when the node loses focus or when {@link
>> #requestFocus()}
>> * is called.
>> *
>> * @defaultValue false
>> * @since 19
>> */
>>
>>
>> The [JBS issue](https://bugs.openjdk.org/browse/JDK-8268225) says:
>>> For JavaFX, "Node.focusVisible" would be set in addition to "Node.focused"
>>> if a scene graph node gained focus as a consequence of keyboard input. In
>>> all other cases, "Node.focusVisible" would not be set on a node.
>
> To clarify, this PR changes nothing in the way FX behaves in relation to
> focus. Nothing. I only provided a public API for use in custom controls.
>
> So whatever discrepancy between FX and w3.org spec you mention (not sure why,
> this isn't an FX spec) applies equally to the existing implementation (if
> not, please let me know - you found a bug).
>
> However, perhaps, you pointing out that the docs may be improved - and you
> are doing so in a very difficult manner. Or maybe you are pointing out the
> fact that we should bring back the traverse(Node, TraversalDirection, boolean
> focusVisible) call?
I just quoted you the JavaFX specification, not W3C. It very clearly says that
the `focusVisible` flag is only set when a node acquires focus as a result of
keyboard navigation. You are proposing to extend the API to change focus
programmatically, and in the process also set `focusVisible`, thus violating
that specification.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1604#discussion_r1819482860