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

Andy Goryachev angorya at openjdk.org
Wed Oct 2 21:14:41 UTC 2024


On Wed, 2 Oct 2024 02:25:26 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> you're saying that you think it is okay that setting a Skin suddenly makes your control malfunction

No, I am not saying that.

I played a bit more with your example.  Your CustomButtonSkin is weird as it does not place the original button in the scene graph, not sure if that's important.

I've added a number of custom components to the example


    static class L extends Label {
        public L(String s) {
            super(s);
            setFocusTraversable(true);
            setMouseTransparent(false);
        }
    }


together with monitoring the scene's focusOwnerProperty (don't want to mess with CSS).

These "L" components do traverse with the arrow keys and your fix with and without the ScrollPane.  So perhaps I am wrong and we do want this change.

A couple of notes:
the existing example, at least when considering its top two panels with the regular buttons, exhibits reduced accessibility when the scroll pane shows a scroll bar.  One can still move focus and the scroll bar does scroll the focused component to view, but one cannot induce it to scroll (for example, if one adds a long label after the last button).

One can try making the scroll pane itself focusTraversable, but then the traversal becomes a bit weird.  Perhaps it's a case for custom traversal policy.

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

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


More information about the openjfx-dev mailing list