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

Button with role="switch" pronounced as checkbox. #11310

Closed
erikkroes opened this issue Jun 27, 2020 · 17 comments · Fixed by #14282
Closed

Button with role="switch" pronounced as checkbox. #11310

erikkroes opened this issue Jun 27, 2020 · 17 comments · Fixed by #14282
Labels
ARIA/1.2 Meeting the W3C Aria 1.2 spec blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. blocked component/speech
Milestone

Comments

@erikkroes
Copy link

When navigating to a <button> with role="switch", it will be pronounced as a checkbox. It is recognized as a toggle button or switch button by accessibility APIs for example, but it is not pronounced as such.
https://www.w3.org/TR/wai-aria-1.2/#switch does state "A type of checkbox that represents on/off values", but it is not a checkbox and has a seperate role. I think it should be pronounced differently.
https://www.w3.org/TR/wai-aria-1.1/#switch does mention "Role: ROLE_SYSTEM_CHECKBUTTON" which might be the cause, but it also states "Object Attribute: xml-roles:switch" which hopefully means thiscan be fixed.

Steps to reproduce:

  1. Open https://codepen.io/erikkroes/pen/WNrOdWp in Chrome version 83.0.4103.116
  2. Navigate to the example <button> with role="switch"

Actual behavior:

Button is announced as "Checkbox".

Expected behavior:

Button is announced as "Switch", or something alike.

System configuration

NVDA 2020.1 installed on Parallels. Chrome version 83. Windows 10.

@Adriani90
Copy link
Collaborator

cc: @feerrenrut, @LeonarddeR is there a way to fix this in NVDA? Actually this element can be navigated by pressing b in browse mode, so it could cause confusions if it is still not pronounced correctly.

@JulienCochuyt
Copy link
Collaborator

Switches are visually buttons, and functionally checkboxes...
Thus, they can currently - and IMHO should remain - reachable by both quick nav by buttons and quick nav by checkboxes.
Sure, announcing them as "Switch buttons" could improve communication with a sighted assistance

What I feel is much more problematic in the current implementation - and demonstrated by the provided example - is that NVDA does not announce the value embedded in the Switch Button. This value can carry important information. Narrator.does announce it.

@JulienCochuyt
Copy link
Collaborator

The mapping of Switch Button to the checkbox role has been established for IA2 as of issue #9187 / PR #10782.
cc @jcsteh

According to #9187 (comment), proper support for role="switch" is still missing from IE11. I have a big IE11 WebModule in the pipe due before the end of this summer, thus I'll probably have to fix this lack pretty soon.

A uniform stance, reducing the behavioral gap between the different supported browsers would IMHO be much preferable.

@Brian1Gaff

This comment has been minimized.

@JulienCochuyt

This comment has been minimized.

@jcsteh
Copy link
Contributor

jcsteh commented Jul 20, 2020

https://www.w3.org/TR/wai-aria-1.2/#switch does state "A type of checkbox that represents on/off values", but it is not a checkbox and has a seperate role. I think it should be pronounced differently.

IMO, toggle button isn't any better than check box. If anything, it's worse because buttons normally have pressed/not pressed states, rather than checked/not checked.

You note that the spec says "a type of checkbox", but you then say "it is not a checkbox". If it's a type of checkbox, it is by definition a checkbox, albeit slightly different to a vanilla checkbox.

Then there's the question of whether it's useful (or even harmful) for users to understand the difference between a checkbox and a switch, especially on desktop. Desktop screen reader users know what a checkbox is. Do they know what a switch is and how to interact with it? Does understanding this difference help users or just give them more things to learn, making the already steep learning curve that tiny bit steeper?

Just my thoughts; this really isn't my decision.

In terms of implementation, if it was decided to change this, we'd need a new NVDA ROLE_SWITCH. We might also need new states for on/off, or alternatively, speech/braille would somehow need to know to present checked/not checked as on/off for a switch. Finally, NVDAObjects.IAccessible.ia2Web.Switch would need to be updated accordingly.

@LeonarddeR
Copy link
Collaborator

What I feel is much more problematic in the current implementation - and demonstrated by the provided example - is that NVDA does not announce the value embedded in the Switch Button. This value can carry important information. Narrator.does announce it.

This applies to all check boxes and was a show stopper for #8858 to use the values for the remaining columns after the first columns The problem is, how to guarantee that the value has meaningful information? Some implementation expose the checked/unchecked state as 0/1 in the accValue, and that's really redundant information.

May be this is worth a separate issue?

@jcsteh
Copy link
Contributor

jcsteh commented Jul 21, 2020

I don't know what is meant by "value" here. An ARIA checkbox can't specify a value. Narrator says on and off for switches instead of checked/not checked, but that's just how Narrator pronounces switches.

@JulienCochuyt
Copy link
Collaborator

Does understanding this difference help users or just give them more things to learn

The confusion may interfere when collaborating with a sighted party.

An ARIA checkbox can't specify a value.

Indeed, but a switch can, and its value is currently unavailable to NVDA users.

Some implementation expose the checked/unchecked state as 0/1 in the accValue, and that's really redundant information.

Do you know which implementations? Could we black- or white- list this? Or filter out obvious redundancies?

@jcsteh
Copy link
Contributor

jcsteh commented Jul 21, 2020 via email

@jcsteh
Copy link
Contributor

jcsteh commented Jul 21, 2020

If you're referring to the text content inside the tag, that is not a value. In fact, the spec says that children of a switch are presentational; they relate only to how the control is presented visually.

@erikkroes

This comment was marked as off-topic.

@feerrenrut
Copy link
Contributor

It looks this issue is stuck. There is some debate about whether this change should be made, though it does look like it could be made.

There is also the discussion on W3C about how switches should be exposed: w3c/core-aam#75

I think this probably should be exposed to the user, since it encourages using a common language when talking about the control, and differentiates a two state switch from a three state (checked, not checked, indeterminate) checkbox

@kpasagada

This comment was marked as off-topic.

@feerrenrut
Copy link
Contributor

On the whole I think this should go ahead, summary of reasoning giving in this thread (for and against):

  • It should be a small low-risk change
  • It isn't technically required, checked/not checked conveys the Boolean nature of switches and toggle buttons.
  • Allows easier communication between SR and non-SR users.
  • Prevent hacky approximations via role-description
  • Give web authors more control over the speech experience.
  • SR users need to learn and familiarize themselves with more controls.

The note on https://www.w3.org/TR/wai-aria-1.2/#switch also reflects this.

NOTE
A switch provides approximately the same functionality as a checkbox and toggle button, but makes it possible for assistive technologies to present the widget in a fashion consistent with its on-screen appearance.

#10644 is also related.

@seanbudd
Copy link
Member

seanbudd commented Aug 25, 2022

Blocked by an internal or external decision discussed in w3c/core-aam#75

@seanbudd seanbudd added the blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. label Oct 5, 2022
michaelDCurran added a commit that referenced this issue Oct 26, 2022
…4282)

Fixes #11310

Summary of the issue:
Currently elements on the web with an ARIA role of "switch" are presented in NVDA as checkboxes.
This is because:
• There is no switch role in IAccessible2
• ARIA practices recommend that browsers map the switch role to the toggleButton role in IAccessible2, but there is some confusion around whether the pressed or checked state should be exposed to denote the switch is on.
• NVDA historically has chosen to deliberately map switches to checkboxes with checked, rather than toggleButton with pressed.
• ARIA practices state that a switch is the same as a checkbox, just with no indeterminate state.
There is a lot of pressure from web authors and standards groups for NVDA to specifically report switch controls as having a role of "switch" rather than checkbox, as it is believed this improves communication between blind and sited individuals, as visually the switch control looks like a switch, not a checkbox.

Description of user facing changes
• switch controls in Firefox, Chrome and Edge, via IAccessible2, are now reported in NVDA as switch controls, rather than checkboxes. 
◦ They are spoken with a role of "switch" and state of either "on" or "off".
◦ In Braille, they are represented with a role of "swtch" and a state braille pattern the same as checked / not checked.

Description of development approach
• Added a new role of SWITCH
• Added a new state of ON
• The negative state of ON is "off".
• Only a role of switch forces a negative of the ON state. I.e. Switch is the only control that will report as "off" if no ON state exists.
• The switch role is treated as having a text presentation type of singleLine, similar to checkbox.
• for IA2Web NVDAObjects and IAccessible2 virtualBuffers (Chrome, Firefox, Edge), IAccessible2 objects with "switch" in xml-roles: 
◦ map to an NVDA role of switch
◦ pressed and checkable states are discarded
◦ the checked state is mapped to the ON state.
The w3c ARIA examples submodule has also been updated to the latest main commit as the existing commit we were on did not yet have the switch example.
@nvaccessAuto nvaccessAuto added this to the 2023.1 milestone Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARIA/1.2 Meeting the W3C Aria 1.2 spec blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. blocked component/speech
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants