RFR: 8091673: Public focus traversal API for use in custom controls [v6]
Michael Strauß
mstrauss at openjdk.org
Tue Oct 29 17:59:17 UTC 2024
On Tue, 29 Oct 2024 17:44:21 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> A general question: what would be an example of when `focused != focusVisible` (and `!= focusWithin`) ?
>
> Shouldn't the `focused` be a sort of "primary" property, and all other derived from it?
>
> What is the purpose of `focusVisible` exactly?
`focusVisible` is almost always `false`, because most of the time, users of a GUI will interact with a mouse (or touch), not with the keyboard. Most desktop user interfaces _only_ show a focus ring around interactive controls if you tab to the element, and _not_ if you click it. This is what this property allows JavaFX applications to replicate (in fact, the built-in themes of JavaFX are an outlier in desktop UI design in that they have permanent focus rings).
Naturally, a control can only visibly indicate focus if it has the input focus. This is why `focusVisible=true` can only occur when `focused=true` and `focusWithin=true`.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1604#issuecomment-2444975606
More information about the openjfx-dev
mailing list