-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS Adapter - Sub roles #477
Comments
Thank you @HolgerGottChristensen for digging into this. We currently don't implement sub roles. I actually investigated this for #372 but forgot to write about it. |
We need to implement the |
Adding support for sub roles would solve part of my problem. I can make a pull request for this feature, but maybe you have some code in chromium I should base it on? The second part of my problem is now solved directly by implementing sub roles. As I understand it AccessKit contain roles for Switch and Checkbox, but not for toggle button. Would you be interested in adding a new AccessKit role for toggle buttons, or should this be implemented in some kind of extension? |
In AccessKit, we express toggle buttons by using the |
Perfect, I knew I had missed something😃 I will create a pull request in the upcoming days. Do you want the implementation based on some chromium code? |
Feel free to look at Chromium code if it clarifies anything for you, but we've diverged from Chromium at this point, and you may be able to figure out a straightforward mapping on your own. |
Looking at Chromium's mapping will save you time. As you can see not all subroles are documented by Apple and Chromium developers had to find the string values on their own. With that being said, some subroles exist and you should use them instead of raw strings. In your specific case, you are looking for |
I have been trying to implement accessibility for some of my controls, and is currently comparing the accessiblity tree generated from my application, and from the equivalent SwiftUI application.
When implementing accessibility for checkboxes, toggle buttons and switches, i noticed the accessibility tree generated by SwiftUI uses the role CheckBox for all the three controls, but with different sub roles.
https://developer.apple.com/documentation/appkit/nsaccessibilitysubrole?language=objc
How is it intended to implement these using AccessKit? I see AccessKit specifies CheckBox and Switch as different roles, but I see no role equivalent to the toggle button.
I can also see when the Switch and CheckBox roles from AccessKit are used, they both set the NSAccessibilityRole CheckBox, but no sub role.
Toggle button from SwiftUI
Checkbox from SwiftUI
Toggle from SwiftUI
The text was updated successfully, but these errors were encountered: