Fix VoiceOver bug for Listbox
component in Chrome
#2824
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Chrome currently has a bug if you use a
Listbox
with aLabel
and use thearia-multiselectable
attribute. This combination will cause VoiceOver to not announce therole="option"
elements when interacting with them.If we drop the
aria-multiselectable
OR thearia-labelledby
it starts working. Alternatively replacingaria-labelledby
witharia-label
won't work either.I filed a Chrome bug report about this here: https://bugs.chromium.org/p/chromium/issues/detail?id=1498261
Luckily there is a workaround in our
Listbox
implementation. Right now we always require theListbox.Button
to be there. TheListbox.Options
component doesn't work on its own in our implementation.This means that whenever we open the
Listbox
that we have to go via theListbox.Button
. ThisListbox.Button
is already labelled by theListbox.Label
if there is one.This also means that we can safely drop the
id
of the label inside thearia-labelledby
from theListbox.Options
.This wouldn't have worked if our
Listbox.Options
could be used in a standalone way without theListbox.Button
.At the end of the day the hierarchy looks like this:
Fixes: #2817