RFR: 8091673: Public focus traversal API for use in custom controls [v3]

Andy Goryachev angorya at openjdk.org
Mon Oct 28 17:46:04 UTC 2024


On Mon, 28 Oct 2024 17:37:36 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> 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.

Maybe we should say that `Node.requestFocusTraversal()` should only be called by custom components/skins as a response to key press?  I can't see a way to enforce that particular rule.

Or perhaps `Node.focusVisible` doc should be updated to include the reference to `Node.requestFocusTraversal()` ?

What's your opinion?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1604#discussion_r1819491100


More information about the openjfx-dev mailing list