Page MenuHomePhabricator

Don't output ARIA attributes with "false" values in component markup
Closed, ResolvedPublic1 Estimated Story Points

Description

There are a couple of places where we output ARIA attributes with bound boolean values – sometimes the value is true, sometimes false, depending on internal component state. Examples include:

  • Tab component: possesses an aria-hidden attribute whose value is false if the tab is active and true if not
  • Tabs and Menu components: items displayed in a list have an aria-selected attribute whose value is true if the item (tab heading or menu item) is currently selected, and false otherwise.

In Vue 2, attributes with false-y values would not get output in the resulting HTML at all. In Vue 3, this behavior changed, and now bindings like aria-selected="false" will get included in the rendered output.

I'm not aware of this change in behavior causing any problems, as a general rule I believe that we are better off by removing attributes like aria-hidden="false" and aria-selected="false" entirely – we are shipping redundant code and might eventually confuse someone (either human user or screen reader).

Acceptance Criteria
  • Find all instances in Codex where aria-* attributes are bound (via v-bind) to a false value
  • Update the code to explicitly provide a null or undefined attribute value here instead (meaning the attribute won't show up in the rendered output unless its value is truthy).

Event Timeline

Restricted Application triaged this task as High priority. · View Herald TranscriptMay 25 2023, 4:23 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 922956 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[design/codex@main] Tab, Tabs, Menu: Don't output ARIA attributes with "false" values

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

egardner set the point value for this task to 1.

Change 922956 merged by jenkins-bot:

[design/codex@main] Tab: Don't output `aria-hidden` attribute with "false" values

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

Change 927786 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v0.11.0 to v0.12.0

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

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/8ca78d2715/w

Change 927786 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.11.0 to v0.12.0

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

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/8ca78d2715/w/