Skip to content
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

feat: Support custom role descriptions #316

Merged
merged 5 commits into from
Jan 3, 2024
Merged

feat: Support custom role descriptions #316

merged 5 commits into from
Jan 3, 2024

Conversation

DataTriny
Copy link
Member

Revamping an old branch, initial work by @mwcampbell.

Implement support for the role_description property on all adapters:

  • Documented the fact that this property should be used sparingly,
  • Tweaked the macOS and Windows implementations after rebase,
  • On Unix: implemented the GetLocalizedRoleName method of the org.a11y.atspi.Accessible interface. Make use of AtspiRole::Extended if a value is supplied, as it is the only way to tell libatspi to query it. Orca still won't announce it because it currently explicitly ignore this role, Accerciser however displays it properly.

Tested on all platforms by modifying the winit example.

@DataTriny DataTriny force-pushed the role-description branch 2 times, most recently from d3458f5 to 17451d8 Compare December 3, 2023 20:48
@mwcampbell
Copy link
Contributor

@DataTriny Are you sure that returning AtSpiRole::Extended in the Unix adapter for all nodes with role descriptions is the correct behavior? It would make more sense to me to do that only if the base AccessKit role is Role::Unknown, or if the base AT-SPI role would otherwise translate to the equivalent of "unknown". By always returning AtSpiRole::Extended, we deny ATs the opportunity to make inferences based on the nearest standard role, e.g. if the role description is "switch" but the base role is check box. But if returning AtspiRole::Extended is the only way to get Orca to pay attention to the role description, then I guess that's a deficiency of AT-SPI.

Also, I believe we need to separate the documentation into its own PR, to avoid making a semver-breaking release of the base accesskit crate. Yes, it's annoying that we have to work around the release automation again.

@DataTriny
Copy link
Member Author

@mwcampbell It depends on which property is more important: the end-user might get more information from the localized role description.

"role description" strongly suggests that it can be used in conjunction with platform-specific roles, halas this is not the case with AT-SPI. I chose to do it like this to have a consistent behavior on all platforms, but your arguments are valid as well.

Yes, I'll extract the documentation update once we settle on a resolution.

@mwcampbell
Copy link
Contributor

OK, if the only way to get AT-SPI clients to pay attention to the role description is to use AtspiRole::Extended, then let's go ahead with that solution.

@mwcampbell
Copy link
Contributor

I wonder if we can get this one finished before I publish releases. I'm OK with the current implementation for AT-SPI, using the Extended role. We just need to split the documentation change into a separate PR so as not to trigger a semver-breaking release of the common crate.

@DataTriny
Copy link
Member Author

Sure! I'll try to do that today or tomorrow.

@mwcampbell mwcampbell merged commit c8d1a56 into main Jan 3, 2024
5 checks passed
@mwcampbell mwcampbell deleted the role-description branch January 3, 2024 21:05
@mwcampbell mwcampbell mentioned this pull request Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants