8379347: VoiceOver Doesn't Correctly Identify JToggleButtons as "toggle buttons"#30096
8379347: VoiceOver Doesn't Correctly Identify JToggleButtons as "toggle buttons"#30096mickleness wants to merge 4 commits intoopenjdk:masterfrom
Conversation
If a button uses Swing's AccessibleRole.TOGGLE_BUTTON, then as far as Apple's UI is concerned: it should have a role of NSAccessibilityCheckBoxRole and a subrole of NSAccessibilityToggleSubrole
|
👋 Welcome back jwood! A progress list of the required criteria for merging this PR into |
|
@mickleness This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 335 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@prrace, @honkar-jdk, @azuev-java) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@mickleness The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
@azuev-java please review |
honkar-jdk
left a comment
There was a problem hiding this comment.
VO announces first part correctly and then it says "To select or deselect the checkbox press Ctrl+Option+Space" Shouldn't it say toggleButton here?
| return NSAccessibilityCheckBoxRole; | ||
| } | ||
|
|
||
| - (NSAccessibilitySubrole _Nullable)accessibilitySubrole |
There was a problem hiding this comment.
Since this is JToggleButton, do we need to add this subrole to ButtonAccessbility.m ?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| String INSTRUCTIONS = "INSTRUCTIONS (Mac-only):\n" + | ||
| "1. Open VoiceOver\n" + | ||
| "2. Move the VoiceOver cursor over the JToggleButton.\n" + | ||
| "3. Observe how VoiceOver identifies the toggle button.\n\n" + | ||
| "Expected behavior: VoiceOver should identify it as a " + | ||
| "\"toggle button\". It should not say \"checkbox\".\n\n" + | ||
| "If you select the link using \"Accessibility " + | ||
| "Inspector\": it should identify its subrole as AXToggle."; |
There was a problem hiding this comment.
You could use text blocks here
There was a problem hiding this comment.
OK, this is updated
Good question, but I think this is the standard behavior. Here is an example of a toggle button in Font Book, which presumably is working according to Apple's standards/expectations. Here VO also says "to select or deselect this checkbox": toggle.button.demo.mp4 |
This is in response to: https://github.com/openjdk/jdk/pull/30096/changes#r2998420677
This is in response to: openjdk#30096 (review)
| return NSAccessibilityCheckBoxRole; | ||
| } | ||
|
|
||
| - (NSAccessibilitySubrole _Nullable)accessibilitySubrole |
There was a problem hiding this comment.
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.
Sounds reasonable. Good to match it with native app behavior. |
|
/integrate |
|
@mickleness |
|
/sponsor |
|
Going to push as commit ac24255.
Your commit was automatically rebased without conflicts. |
|
@azuev-java @mickleness Pushed as commit ac24255. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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:
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30096/head:pull/30096$ git checkout pull/30096Update a local copy of the PR:
$ git checkout pull/30096$ git pull https://git.openjdk.org/jdk.git pull/30096/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30096View PR using the GUI difftool:
$ git pr show -t 30096Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30096.diff
Using Webrev
Link to Webrev Comment