Page MenuHomePhabricator

ToggleButtonWidget inherits `aria-checked="true"` which is wrong
Closed, ResolvedPublic

Description

ToggleButtonWidget inherits aria-checked="true" which is a severe error, as this ARIA attribute should only be used on elements like checkboxes or radios..
ToggleWidget initially got this added in v0.6.4. ToggleButtonWidget was added later without reevaluating the inherited attributes.

Proposal A:

As the button features aria-pressed anyways, we should remove the attribute specifically from ToggleButtonWidget.

Proposal B:

Keep the area-checked attribute, and add the role=checkbox attribute to the parent.

Event Timeline

Why is it wrong? I think it's closer to a checkbox with label, than a real button. If you couldn't see its design, you'd think it behaves just like a checkbox.

Because it doesn't feature a role=checkbox or role=radio here. And as I said above, the better way out is IMO to remove superfluous aria-checked on it than adding another role, when role=button or element with strong semantic with correct ARIA property is already available on child element which is the triggerable element anyways.

The button role is probably misleading for a button that actually acts more like a checkbox.

The button role is probably misleading for a button that actually acts more like a checkbox.

That is not necessary from the specification. [[ https://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed | aria-pressed is sufficient for transforming ]] a button into a toggle button for assistive technology.
But having both attributes might result in errors for screen readers.

Change 352194 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[oojs/ui@master] ToggleButtonWidget: Remove misleading aria-checked attribute

https://gerrit.wikimedia.org/r/352194

Change 352194 merged by jenkins-bot:
[oojs/ui@master] ToggleButtonWidget: Remove misleading aria-checked attribute

https://gerrit.wikimedia.org/r/352194

Volker_E moved this task from Reviewing to OOjs-UI-0.21.3 on the OOUI board.
Volker_E edited projects, added OOUI (OOjs-UI-0.21.3); removed OOUI.
Volker_E removed a project: Patch-For-Review.
Volker_E removed a subscriber: gerritbot.