You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running a Lighthouse report for mobile on the playground (opened in a new window) returns this warning about a missing accessible name:
Getting the same on my own site running Autocomplete version 1.6.2.
Running a simple document.getElementById('autocomplete-0-label') confirms that there is no such element. (Meanwhile document.getElementsByClassName('aa-Autocomplete')[0] shows the autocomplete element to, indeed, exist with attribute aria-labelledby="autocomplete-0-label".)
Please note:
Said label is missing on the empty state on mobile.
It's fine after loading some data (performing a search) on mobile.
It's fine on desktop.
Reproduction
Go to the playground and run Lighthouse for mobile.
Expected behavior
Would expect:
the label to exist any time '.aa-Autocomplete' exists.
It seems that the label actually exists, but only has a button inside it, and not a more relevant label like "search" (can be visually hidden of course). It seems like the button should be a sibling rather than a child of the label, but I don't know if fixing that would be a breaking change
In detached mode, the label only exists when the search modal is open. When it isn't, there's only the search button in the DOM which wrapper has the role="combobox" and aria-labelledby="autocomplete-0-label". But because the label is in the modal (which is absent from the DOM), Lighthouse legitimately reports an accessibility issue.
One simple solution would be to add a <label> near the search button (visually hidden) when the modal is closed, and remove is when it opens so that the combobox is now labelled by the one in the modal.
Another option would be to reconsider having the role="combobox" around the search button in detached mode. I gather that the goal may have been to express that an unexpanded combobox is in the page, but although we could fix the Lighthouse, it may not be an optimal solution for someone actually relying on a screenreader.
Reacted by Haroen Viaene, Nick Sergeant and Signe Kirk Brødbæk
Echoing @signekb's question - what is the status on this? Universities are going to have to comply with WCAG 2.2 soon, and I'm concerned about personal liability if I can't figure out how to fix this in my quarto projects.
Activity
Haroenv commentedon May 2, 2022
Here's the relevant part of the code:
autocomplete/packages/autocomplete-js/src/createAutocompleteDom.ts
Line 83 in 24cf9d6
It seems that the label actually exists, but only has a button inside it, and not a more relevant label like "search" (can be visually hidden of course). It seems like the button should be a sibling rather than a child of the label, but I don't know if fixing that would be a breaking change
sarahdayan commentedon May 16, 2022
In detached mode, the label only exists when the search modal is open. When it isn't, there's only the search button in the DOM which wrapper has the
role="combobox"andaria-labelledby="autocomplete-0-label". But because the label is in the modal (which is absent from the DOM), Lighthouse legitimately reports an accessibility issue.One simple solution would be to add a
<label>near the search button (visually hidden) when the modal is closed, and remove is when it opens so that the combobox is now labelled by the one in the modal.Another option would be to reconsider having the
role="combobox"around the search button in detached mode. I gather that the goal may have been to express that an unexpanded combobox is in the page, but although we could fix the Lighthouse, it may not be an optimal solution for someone actually relying on a screenreader.signekb commentedon Jun 13, 2024
Hi!
I found the issue on quarto-dev/quarto-cli#678 and was wondering what the status is on this?
srvanderplas commentedon Dec 18, 2024
Echoing @signekb's question - what is the status on this? Universities are going to have to comply with WCAG 2.2 soon, and I'm concerned about personal liability if I can't figure out how to fix this in my quarto projects.
fix(a11y): add aria-label to div (algolia#963)
fix(a11y): add aria-label to div (#963) (#1313)