Page MenuHomePhabricator

axe-core 4.6 makes new-lexeme-special-page a11y tests fail
Closed, ResolvedPublic

Description

I ran the new-lexeme-special-page tests with axe-core 4.6.2 and ran into the following failure (excerpt from some add hoc debug logging):

{
  any: [ [Object] ],
  all: [],
  none: [],
  impact: 'critical',
  html: `<input type="text" class="wikit wikit-Input" placeholder="The Lexeme's language, e.g. 'English'" autocomplete="off" id="wikit-Lookup-695051" aria-owns="wikit-OptionsMenu-956787" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="true" aria-required="true" role="combobox">`,
  target: [ '#wikit-Lookup-695051' ],
  failureSummary: 'Fix any of the following:\n' +
    '  Required ARIA attribute not present: aria-controls'
}

These failures seem to be coming from wikit's LookupInput.

Event Timeline

Hm, if I understand MDN: aria-controls correctly, Wikit should set the input’s aria-controls to the same ID as the aria-owns? (I.e., the input should both control and own the “combobox popup”.)

Hm, if I understand MDN: aria-controls correctly, Wikit should set the input’s aria-controls to the same ID as the aria-owns? (I.e., the input should both control and own the “combobox popup”.)

I think so, yes... although I'm not sure aria-owns is still needed in that case (although it doesn't seem like it would be wrong either).

Seems to work when I try it locally, at least. (Note: after editing Wikit, you not only have to copy the new dist files into node_modules/@wmde/wikit-vue-components/, you also have to remove node_modules/.vite/.)

https://github.com/wmde/wikit/pull/674

We might also want to propose this change to Codex, their Lookup currently also has aria-owns but not aria-controls. (Edit: done in Ia9207a6af5.)

MDN describes the usefulness of aria-owns in our Lookup case very well:

An "owning element" is any DOM ancestor of an element. If an element visually, functionally, or contextually appears to "own" (be an ancestor of) an element, but isn't actually an ancestor the element in the DOM, include the aria-owns to create that relationship.

As the menu and the input are siblings, it's rightful to provide aria-owns as well. Mentioned on the patch, we should add the attribute to Combobox as well.

And when I locally update axe-core to 4.6, the tests pass now \o/ I’ll upload a PR for that once the Wikit upgrade is merged.

Change 881364 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] Bump new-lexeme to pull in a11y improvements

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

Change 881364 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Bump new-lexeme to pull in a11y improvements

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