On Fri, 27 Mar 2026 02:52:42 GMT, Jeremy Wood <[email protected]> wrote:

>> src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.m 
>> line 39:
>> 
>>> 37: }
>>> 38: 
>>> 39: - (NSAccessibilitySubrole _Nullable)accessibilitySubrole
>> 
>> Since this is JToggleButton,  do we need to add this subrole to 
>> ButtonAccessbility.m ?
>
> I'm not sure I understand your question.
> 
> Currently if any java.awt.Component has the role 
> AccessibleRole.TOGGLE_BUTTON: then (based on the new proposed changes to 
> CommonComponentAccessibility) that java.awt.Component is mapped to a 
> CheckboxAccessibility object.
> 
> By contrast: if a java.awt.Component uses AccessibleRole.PUSH_BUTTON, then it 
> is mapped to a ButtonAccessibility object.
> 
> ... so as I understand it: assuming roles are immutable, we'll never use 
> ButtonAccessibility.m for toggle buttons. So I don't think 
> ButtonAccessibility.m will benefit from the subrole getter here. (We could 
> add it someday for other subroles, like NSAccessibilityToolbarButtonSubrole, 
> but that's outside the scope of this ticket.)
> 
> Does that speak to your question, or did I misunderstand what you're asking?

Let me re-phrase for clarity:

Initially I thought for JToggleButton, AccessibleRole => Button and 
AccessibleSubRole => toggleButton made more logical sense.

I made slight modification as below -
[rolesMap setObject:@"**ButtonAccessibility"** forKey:@"togglebutton"];
and moved the above code snippet to ButtonAccessbility.m.
 
With this change the VO announces that it is JToggleButton and to 
select/deselect **button** press  Ctrl + Option + Space which seemed correct.

Revisited the code and I believe "checkbox" Role is more appropriate for 
JToggleButton for another reason as well - **accessibilityValue**  for 
NSAccessibilityButtonRole is NULL which may not be the correct return value for 
JToggleButton.

In short, your changes look good. Thanks for the details.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30096#discussion_r3003704396

Reply via email to