RFR: 8091673: Public focus traversal API for use in custom controls [v3]
Michael Strauß
mstrauss at openjdk.org
Mon Oct 28 17:31:54 UTC 2024
On Mon, 28 Oct 2024 16:05:40 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> 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.
So you're proposing to change the specification of `focusVisible`. That needs to be discussed first.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1604#discussion_r1819460423
More information about the openjfx-dev
mailing list