RFR: 8091673: Public focus traversal API for use in custom controls [v6]
Nir Lisker
nlisker at openjdk.org
Tue Oct 29 21:56:14 UTC 2024
On Tue, 29 Oct 2024 21:47:53 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
> > > Also something that just occurred to me, but perhaps I'm late to the party; with the current API being on `Node` you could call `requestFocusTraversal` on basically any `Node`, even one that is currently not focused. I'm not sure if this is intentional or that the API should perhaps only work from the current focused node.
> >
> >
> > I saw this already in the previous PR and thought it's intentional. Even with this method being outside of `Node`, it takes a `Node` argument, which is arbitrary too. If you want to limit it, you'll have to throw or no-op on an unfocused node. I don't think that's necessary.
>
> Well, the API could be on `Scene`, in which case you just call `Scene#requestFocusTraversal(Direction)`, as `Scene` knows what the focused node is.
In that case, you are right. I don't have a strong opinion as I am not an advanced user of focus. The current behavior is good enough for me.
By the way, if you have multiple scenes in the stage, and each one has its own focused node, which node receives keyboard input?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1604#issuecomment-2445398803
More information about the openjfx-dev
mailing list