UrlInput: Stick to the ARIA 1.0 pattern #47147
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Type] Bug
An existing feature does not function as intended
[Type] Regression
Related to a regression in the latest release
Description
I was wondering why Safari + VoiceOver fail reading the options of the UrlInput combobox while they do announce the options of the Tag suggestions. Screenshot:
Turns out the input field of UrlInput uses
aria-controls
while the one of the Tag suggestions usesaria-owns
. This was changed in #43278 and only for the UrlInput component.Please notice that making a change that may look trivial can actually have a huge impact on assistive technology. Also, Safari + VoiceOver are known to be buggy with comboboxes.
It's very, very, important to actually test the impact of such changes on the most common browsers / screen reader combinations. Even the most simple changes need to be testsd.
TL;DR
The change in #43278 was made following on this comment, based on a recommendation on the MDN combobox documentation:
Unfortunately, that's inaccurate.
It is true the newer ARIA specs recommends
aria-controls
. However, the combobox ARIA pattern evolved over time across the ARIA 1.0, 1.1, and 1.2 specs. It is important to note that the HTML structure itself changed, together with the usage of some aria-properties. To recap:ARIA 1.2
It's still a 'Candidate Recommendation Draft', stuck on 08 December 2021. As such, it's not a official recommendation and it's not guaranteed to be implemented by vendors.
It provides an interesting note at https://www.w3.org/TR/wai-aria-1.2/#combobox
Here's the HTML example in ARIA 1.2:
Again, we can't use this pattern.
ARIA 1.1
ARIA 1.1 is the current official recommendation, dated 14 December 2017.
As mentioned in ARIA 1.2, the 1.1 combobox pattern was not broadly supported by assistive technologies, Basically it doesn't work well and we can't use it.
Here's the HTML example in ARIA 1.1, where a div element 'owns' both the input and the listbox (via nesting and aria-owns):
Again, we can't use this pattern.
ARIA 1.0
This is an old pattern but it's the only one that is currently broadly supported. It uses
aria-owns
in the input field.Here's the HTML example in ARIA 1.0:
By restoring
aria-owns
, Safari + VoiceOver magically announce the options again.Aside
There's one more detail that needs to be improved.
The
aria-selected
attribute needs to be rendered only on the 'highlighted' option and omitted from all the other options. The only allowed usage ofaria-selected
with a value offalse
in an ARIA listbox is when the Listbox allows selcting multiple items.To clarify, here's a screenshot from the W3C ARIA Authoring Practices Editable Combobox with List Autocomplete:
Step-by-step reproduction instructions
Note: as mentioned above, Safari and VoiceOver are buggy anyways. When testing, you may notice some weirdness also when using the Tag selector. They announce things differently or in a buggy way e.g.:
{option name}, clickable
{option name}, selected, (1 of n), completion selected
(this is the expected behavior)Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: