-
Notifications
You must be signed in to change notification settings - Fork 16.9k
feat: enable more granular a11y feature management #48042
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
Conversation
2cabba1 to
b413846
Compare
| ### `app.getAccessibilitySupportFeatures()` _macOS_ _Windows_ | ||
|
|
||
| Returns `string[]` - Array of strings naming currently enabled accessibility support components.Possible values: | ||
|
|
||
| * `nativeAPIs` - Native OS accessibility APIs integration enabled. | ||
| * `webContents` - Web contents accessibility tree exposure enabled. | ||
| * `inlineTextBoxes` - Inline text boxes (character bounding boxes) enabled. | ||
| * `extendedProperties` - Extended accessibility properties enabled. | ||
| * `screenReader` - Screen reader specific mode enabled. | ||
| * `html` - HTML accessibility tree construction enabled. | ||
| * `labelImages` - Accessibility support for automatic image annotations. | ||
| * `pdfPrinting` - Accessibility support for PDF printing enabled. | ||
|
|
||
| Notes: | ||
|
|
||
| * The array may be empty if no accessibility modes are active. | ||
| * Use `app.isAccessibilitySupportEnabled()` for the legacy boolean check; | ||
| prefer this method for granular diagnostics or telemetry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codebytere is there a default set of accessibility modes enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkleinsc yes, more or less - the way we configured it after the recent refactor was that app.setAccessibilitySupportEnabled() uses ui::kAXModeComplete, which encompasses:
AXMode::kNativeAPIs |
AXMode::kWebContents |
AXMode::kInlineTextBoxes |
AXMode::kExtendedProperties
I wasn't sure whether or how to include that in the new APIs - open to any thoughts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codebytere we should just document the above in the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
49deabe to
3000f89
Compare
9e30735 to
bab9692
Compare
jkleinsc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
|
|
||
| > [!NOTE] | ||
| > Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default. | ||
| > Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default. Calling this method will enable the following accessibility support features: `nativeAPIs`, `webContents`, `inlineTextBoxes`, and `extendedProperties`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: would it be more intuitive if we made setAccessibilitySupportEnabled enable all available properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erickzhao i'd say no as that'd be a breaking change - this also matches upstream.
| ### `app.getAccessibilitySupportFeatures()` _macOS_ _Windows_ | ||
|
|
||
| Returns `string[]` - Array of strings naming currently enabled accessibility support components. Possible values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our docs parser has the ability to generate unions of string literals, though I don't know what the exact syntax is needed to achieve that. @erickzhao pointed me to app.getPath as an API that utilizes this.
It seems like it could be useful to have a more explicit TypeScript type, so that people could get TypeScript warnings for non-exhaustive switch statements, or for passing an invalid string to setAccessibilitySupportFeatures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually @MarshallOfSound thinks this should be possible to get specific types for. Ref https://github.com/electron/typescript-definitions/blob/ec3384a33fa0d70d98ffc998b03c771535cc1dd9/src/utils.ts#L153-L167
We might just need to tweak/debug the syntax to get the parser to parse it correctly
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
bab9692 to
d1330ec
Compare
reitowo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
erickzhao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
itsananderson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
It'd be great to find a way to document the string literal types, but it sounds like there are limitations in the docs parser that make it infeasible right now.
If we merge this as-is, and follow up later to make getAccessibilitySupportFeatures take string literals instead of just string[], it may cause minor typechecking errors for apps that are storing values as string, but it should be an easy thing for those apps to fix the type errors when upgrading.
|
Release Notes Persisted
|
|
I have automatically backported this PR to "39-x-y", please check out #48625 |
|
I have automatically backported this PR to "38-x-y", please check out #48626 |
|
I have automatically backported this PR to "37-x-y", please check out #48627 |
* feat: enable more granular a11y feature management * Update docs/api/app.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* feat: enable more granular a11y feature management * Update docs/api/app.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* feat: enable more granular a11y feature management * Update docs/api/app.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* feat: enable more granular a11y feature management * Update docs/api/app.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Description of Change
It's been possible to enable accessibility settings on a more granular level for some months now - after #46118 our existing a11y support methods also became more confusing as it's no longer really correct or useful to only see whether accessibility support is enabled as it could be enabled partially and the user has no insight into which parts. This adds two new methods,
app.getAccessibilitySupportFeatures()andapp.setAccessibilitySupportFeatures(features)allowing the user to access more granular a11y feature management.Checklist
npm testpassesRelease Notes
Notes: Added methods to enable more granular accessibility support management.