Fix reporting of ARIA role="switch" in Firefox and Chrome.#10782
Merged
Conversation
The spec maps role="switch" to IA2_ROLE_TOGGLE_BUTTON. However, it also says that aria-checked should be used for switch, not aria-pressed, and aria-checked is mapped to the checked state. Firefox does exactly as specified, resulting in NVDA reporting weirdness like "toggle button not pressed checked". Chrome exposes both checked and pressed, resulting in NVDA reporting weirdness like "toggle button checked pressed". Since the spec says that a switch is "a type of checkbox", resolve this mess by mapping switch to check box and killing the pressed state.
Contributor
Author
|
Looking briefly at the code, Orca seems to have specific handling for xml-roles:switch (though I'm not sure where it does the state mapping). That will probably complicate getting this changed in the mapping spec. It probably makes sense to just push ahead with this given that we have a working patch. |
michaelDCurran
approved these changes
Feb 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Fixes #9187.
CC @MarcoZehe.
Summary of the issue:
The spec maps role="switch" to IA2_ROLE_TOGGLE_BUTTON. However, it also says that aria-checked should be used for switch, not aria-pressed, and aria-checked is mapped to the checked state.
Firefox does exactly as specified, resulting in NVDA reporting weirdness like "toggle button not pressed checked".
Chrome exposes both checked and pressed, resulting in NVDA reporting weirdness like "toggle button checked pressed".
Description of how this pull request fixes the issue:
Since the spec says that a switch is "a type of checkbox", resolve this mess by mapping switch to check box and killing the pressed state.
Testing performed:
data:text/html,<div role="switch">testIn both Firefox and Chrome, confirmed that NVDA reports "check box not checked test" in browse mode and "test check box not checked" with object navigation. Note that this won't report "not checked" without #10781.
data:text/html,<div role="switch" aria-checked="true">testIn both Firefox and Chrome, confirmed that NVDA reports "check box checked test" in browse mode and "test check box checked" with object navigation.
Also confirmed that "x" quick navigation reaches switches and that they appear in Elements List.
Known issues with pull request:
There's some controversy around whether this should be mapped to toggle button (pressed/not pressed) or check box (checked/not checked). The spec says that a switch is "a type of checkbox", so I went with that, but the spec is hardly clear given that it maps to toggle button. One other argument in favour of this is that associating it with check box quick nav distinguishes it from purely actionable "buttons".
There's also some discussion of getting this fixed in the spec/browsers; e.g. having browsers map it to role checkbox. See w3c/aria-practices#1327
Change log entry:
Bug fixes:
- ARIA switch controls no longer report confusing information such as "not pressed checked" or "pressed checked". (#9187)