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

Andy Goryachev angorya at openjdk.org
Mon Oct 28 16:13:38 UTC 2024


On Mon, 28 Oct 2024 06:09:40 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   review comments
>
> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 10443:
> 
>> 10441:     /**
>> 10442:      * Requests focus traversal from this {@code Node} in the specified direction.
>> 10443:      * A successful traversal results in the newly focused {@code Node} visibly indicating its focused state.
> 
> What's the rationale behind always setting the `focusVisible` bit when doing programmatic focus traversal? Visible focus is always cleared when calling the existing `requestFocus()` method, since it is specified to _only_ be set when focus is acquired by keyboard navigation.
> 
> Maybe we should have the next node visibly indicate focus if (and only if) the current node visibly indicates focus. This would be consistent with the [Selectors 4 spec](https://www.w3.org/TR/selectors-4/#the-focus-visible-pseudo):
>> If the previously-focused element indicated focus, and a script causes focus to move elsewhere, the newly focused element should indicate focus.
> 
>> 
>> Conversely, if the previously-focused element did not indicate focus, and a script causes focus to move elsewhere, the newly focused element should also not indicate focus.

The rationale is that this PR does not change the way the current focus subsystem works, only provides the public API.

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

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


More information about the openjfx-dev mailing list