ToggleButton behavior

Martin Fox martin at martinfox.com
Sun Dec 3 01:57:46 UTC 2023


I took a look at the W3C accessibility guidelines for radio button groups <https://www.w3.org/wiki/RadioButton> 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/20231202/0d927092/attachment.htm>


More information about the openjfx-dev mailing list