[External] : Re: ToggleButton behavior

Andy Goryachev andy.goryachev at oracle.com
Thu Dec 14 22:18:23 UTC 2023


Oh yes, this is another of those boxes that belong to Pandora:

https://bugs.openjdk.org/issues/?jql=text%20~%20%22focus%20traversal%22%20AND%20project%20%3D%20JDK%20AND%20component%20%3D%20javafx%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20%20DESC

and

https://bugs.openjdk.org/browse/JDK-8292933

It’s one of those areas where we could benefit from a redesign or a proper FocusManager.  Right now they all sit along with the rest of ~3.5K open tickets, unfortunately.

I don’t know what to say.  Getting even a small improvement is extremely difficult – judging by one recent issue - two months of discussion result in a lot of good ideas and zero improvement (at least so far).  If a large Oracle customer escalates and requests a fix, that might help.

-andy


From: Martin Fox <martin at martinfox.com>
Date: Thursday, December 14, 2023 at 13:26
To: Andy Goryachev <andy.goryachev at oracle.com>
Cc: John Hendrikx <john.hendrikx at gmail.com>, openjfx-dev <openjfx-dev at openjdk.org>
Subject: [External] : Re: ToggleButton behavior
Hi Andy,

The Mozilla doc you pointed to basically re-iterates the W3C guidelines. When a ToggleButton is in a group it should behave like other grouped controls where Tab gets you into and out of the group and the arrow keys navigate within the group. I would still argue that an ungrouped ToggleButton should traverse like any other button.

I’m not familiar enough with JavaFX’s focus traversal implementation to have an opinion. Based on past experience I wouldn’t wade into those waters until I had a plan in place for how to validate the results. In my previous job we did a big accessibility push and ended up assigning one engineer whose primary job was liaising with accessibility tool vendors to make sure we got it right. She was worth her weight in gold.

(Whatever happened to the issue where multiple nodes in a scene can set their focused property? As I recall someone on the controls side needed to dig in and figure out what was going on there.)

Martin


On Dec 7, 2023, at 12:40 PM, Andy Goryachev <andy.goryachev at oracle.com> wrote:

Dear Martin:

It's hard to say.  How does it work in Swing?

There is also https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role<https://urldefense.com/v3/__https:/developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role__;!!ACWV5N9M2RV99hQ!Pqn80CGcJ61ns3cB2o2_jkSovpJzQ6OeTP_fL-GaG-7dM81ZjdA-LXoM49JYC9KvVErs-vBrhOyYxvoqTs8hRQ$>

I always felt that the focus management in JavaFX is underdeveloped: multiple focused nodes, nodes getting simultaneous input, lack of coherent geometry-based focus traversal policy, and a lack of public APIs for a custom focus traversal policy.

Are there any ideas?

-andy


From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Martin Fox <martin at martinfox.com>
Date: Saturday, December 2, 2023 at 17:58
To: John Hendrikx <john.hendrikx at gmail.com>
Cc: openjfx-dev <openjfx-dev at openjdk.org>
Subject: Re: ToggleButton behavior
I took a look at the W3C accessibility guidelines for radio button groups<https://urldefense.com/v3/__https:/www.w3.org/wiki/RadioButton__;!!ACWV5N9M2RV99hQ!Pqn80CGcJ61ns3cB2o2_jkSovpJzQ6OeTP_fL-GaG-7dM81ZjdA-LXoM49JYC9KvVErs-vBrhOyYxvrNn8iQnQ$> since that’s the closest thing I could find to a group of ToggleButtons. The W3C suggests that Tab/Shift+Tab takes you in and out of the group and the arrow keys navigate within the group with wrap-around. Based on that (3) is correct.

That’s where the W3C guidance ends; a single radio button doesn’t make much sense so it’s not even mentioned. I would expect a single ungrouped ToggleButton to navigate like a checkbox so (1) seems wrong. A group with just one ToggleButton is an odd thing so (2) could go either way.

Martin

On Dec 1, 2023, at 11:21 PM, John Hendrikx <john.hendrikx at gmail.com> wrote:

In my exploration of a potential Behavior API, I discovered this oddity in how ToggleButtons work.

1. If you have a single ToggleButton that is not part of a ToggleGroup, you can't navigate away from it with the arrow keys, only by using Tab or Shift-Tab.

2. If you have that same single ToggleButton, but it does have a group (a group of one) then you CAN navigate away from it with the arrow keys.

3. When you have two ToggleButtons, both part of the same group, then you can only navigate away from the group with Tab or Shift-Tab again, as the arrow keys will loop back to the first/last button when the end of the group is reached.

I get the impression at least one of these is incorrect.

I mean, either ToggleButtons should always loop, even if it is a group of one, meaning (2) would be incorrect...

Or... ToggleButtons should never loop, in which case (1) and (3) are incorrect...

Or... Single ToggleButtons (grouped or not) behave differently and don't do looping, in which case (1) is incorrect

Thoughts?

--John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20231214/61423da8/attachment-0001.htm>


More information about the openjfx-dev mailing list