On Fri, 27 Mar 2026 00:44:04 GMT, Harshitha Onkar <[email protected]> wrote:
>> With this PR: VoiceOver correctly identifies a JToggleButton as a "toggle >> button" (instead of a "checkbox") >> >> This adds the subrole of NSAccessibilityToggleSubrole (which Accessibility >> Inspector shows as the subrole "AXToggle"). >> >> >> In the screenshot the subrole appears as expected, and the "class" (in the >> "element") section is different from production: >> >> <img width="1920" height="1080" alt="toggled button fixed" >> src="https://github.com/user-attachments/assets/b449e273-c089-4930-a968-9ea8643f3ac0" >> /> > > 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? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30096#discussion_r2998715502
