Skip to content

Fix reporting of ARIA role="switch" in Firefox and Chrome.#10782

Merged
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:switch
Feb 16, 2020
Merged

Fix reporting of ARIA role="switch" in Firefox and Chrome.#10782
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:switch

Conversation

@jcsteh

@jcsteh jcsteh commented Feb 12, 2020

Copy link
Copy Markdown
Contributor

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">test
In 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">test
In 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)

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.
@jcsteh

jcsteh commented Feb 13, 2020

Copy link
Copy Markdown
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.

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.

NVDA announces a button with role="switch" and aria-checked="true" as "pressed checked"

3 participants