RFR: 8340852: ScrollPane should not consume navigation keys when it doesn't have direct focus

Martin Fox mfox at openjdk.org
Wed Oct 2 21:03:39 UTC 2024


On Wed, 2 Oct 2024 20:12:00 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> > Focus either lies on the node that owns the ScrollPane (like a TableView) or one of the nodes inside the ScrollPane but not on the ScrollPane itself.
> 
> this seems to be incorrect: unless you set `mouseTransparent`, ScrollPane can be focused with a mouse click, even when `focusTraversable` is false.

I didn't say that a ScrollPane couldn't take focus, just that it normally doesn't. And if focus lies with a node inside the ScrollPane we can't expect a user to move focus to the ScrollPane to get PgUp and PgDn working.

> > I can’t think of an instance where a ScrollPane receives focus.
> 
> when there is a non-interactive content inside (such as image or a label). they you _do_ want to handle arrow keys to scroll.

Unless that would make the ScrollPane a traversal dead-end.

It's a conundrum. There are cases where the arrows should scroll particularly for top-level content (I can use them to scroll through a web page in Safari). But from what I can tell this is not the default behavior in the macOS toolkit probably because it interferes with traversal.

Whatever behavior we want the way it's implemented in JavaFX at the moment is wrong.

BTW, I'm not optimistic that we can find some combination of modifiers + arrow keys to use. The behavior of Shift is already defined and many of the other modifier + arrow combinations are used by one OS or another.

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

PR Comment: https://git.openjdk.org/jfx/pull/1582#issuecomment-2389688904


More information about the openjfx-dev mailing list