There are essentially two ways to build a switch widget:
Using a button element with role="switch" and aria-checked" (instead of aria-pressed)
Using a checkbox element with role="switch" and aria-checked to be toggled (unless it is sufficient to use the underlying HTML checked state, I do not see the ARIA spec being clear on whether this is possible).
Different screen reader/browser combinations expose switches inconsistently, some expose the underlying semantics without mentioning a switch, others expose the switch but also mention it as both "pressed" and "checked" or even "on".
The discussion points out the inconsistency between the ARIA spec, which says that "a switch it a type of checkbox" (see the definition of the switch role), and the AAM spec, which recommends mapping a switch as a toggle button.
I think we need a common source of truth to run these tests and fine-tune these behavior, an example of the switch role in the APG along with two examples, one based on a toggle button, one based on a checkbox.
The outcome, as far as the screen reader user experience is concerned, should be the same.
I think there is enough confusion here to warrant a separate entry for the switch role (independent of checkboxes and toggle buttons).
There are essentially two ways to build a switch widget:
role="switch"
andaria-checked"
(instead ofaria-pressed
)role="switch"
andaria-checked
to be toggled (unless it is sufficient to use the underlying HTML checked state, I do not see the ARIA spec being clear on whether this is possible).Different screen reader/browser combinations expose switches inconsistently, some expose the underlying semantics without mentioning a switch, others expose the switch but also mention it as both "pressed" and "checked" or even "on".
There is a good discussion of this in NVDA issue 9187.
The discussion points out the inconsistency between the ARIA spec, which says that "a switch it a type of checkbox" (see the definition of the switch role), and the AAM spec, which recommends mapping a switch as a toggle button.
I think we need a common source of truth to run these tests and fine-tune these behavior, an example of the switch role in the APG along with two examples, one based on a toggle button, one based on a checkbox. The outcome, as far as the screen reader user experience is concerned, should be the same.
I think there is enough confusion here to warrant a separate entry for the switch role (independent of checkboxes and toggle buttons).