Skip to content

Add valid labels for search button and input fields (a11y issue) #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #8706
batpigandme opened this issue Apr 18, 2022 · 9 comments
Closed
Tracked by #8706
Labels
accessibility bug Something isn't working search upstream Bug is in upstream library
Milestone

Comments

@batpigandme
Copy link
Contributor

batpigandme commented Apr 18, 2022

Both the collapsed and expanded search features (the button, and then the input field) currently have aria-labelledby properties set that reference an element that doesn't exist (and, thus, they have no label)

<div class="aa-Autocomplete" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-labelledby="autocomplete-0-label">
<button class="aa-DetachedSearchButton">
...
</button>
</div>

There are three associated accessibility issues I get related to the search:

  1. ARIA input fields must have an accessible name
    Element: <div class="aa-Autocomplete" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-labelledby="autocomplete-0-label">
  2. Buttons must have discernible text
    Element: <button class="aa-DetachedSearchButton">
  3. ARIA attributes must conform to valid values
    Element: <div class="aa-Autocomplete" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-labelledby="autocomplete-0-label">
    Error: ARIA attribute element ID does not exist on the page: aria-labelledby="autocomplete-0-label"

The third presumably applies to the search input when opened on the element below:

<input class="aa-Input" aria-autocomplete="both" aria-labelledby="autocomplete-0-label" id="autocomplete-0-input" autocomplete="off" autocorrect="off" autocapitalize="off" enterkeyhint="search" spellcheck="false" placeholder="" maxlength="512" type="search">

As far as internationalization goes, it looks like the buttons have translation parameters in the Algolia docs.

Link to issue report from audit with axe: https://axe.deque.com/issues/7854d2a8-7632-43fd-98a7-ad22683ed4d5

@dragonstyle dragonstyle self-assigned this Apr 19, 2022
@jjallaire jjallaire added this to the Future milestone Jun 8, 2022
@dragonstyle dragonstyle modified the milestones: Future, v1.3 Sep 9, 2022
@dragonstyle dragonstyle added the bug Something isn't working label Mar 1, 2023
@dragonstyle
Copy link
Collaborator

This is injected by our auto-complete library, so the simplest fix would be upstream- related issue:

algolia/autocomplete#963

For now, postponing and I'll work on trying to get fixed upstream.

@dragonstyle dragonstyle modified the milestones: v1.3, v1.4 Mar 7, 2023
@dragonstyle dragonstyle modified the milestones: v1.4, v1.5 Aug 8, 2023
@cscheid cscheid added the upstream Bug is in upstream library label Feb 1, 2024
@dragonstyle dragonstyle modified the milestones: v1.5, Future Feb 7, 2024
@cscheid cscheid mentioned this issue Feb 12, 2024
13 tasks
@signekb
Copy link

signekb commented Jun 13, 2024

Hi!
What's the status on this? I'm having the same issue with the search button.

@cderv
Copy link
Collaborator

cderv commented Jun 13, 2024

Upstream issue is still opened, and iIssue here also as we didn't do any specific handling on Quarto side.

As said, this would need to be dealt upstream in the autocomplete library.

So work to be done (which is usally the status for issue still opened in this repo)

@signekb
Copy link

signekb commented Jun 13, 2024

Ah, yeah, makes sense. Thanks for getting back to me so quickly.

@srvanderplas
Copy link

This is going to be a much bigger issue soon, as WCAG 2.2 guidelines roll out to universities and any page used in any course must be compliant under ADA. I don't have the skills to fix this, but just boosting because I'm auditing my quarto book and finding that the search and sidebar are my biggest issues at the moment.

@cderv cderv modified the milestones: Future, v1.7 Dec 18, 2024
@cderv
Copy link
Collaborator

cderv commented Dec 18, 2024

This requires an upstream library fix. It does not seem it gets traction there so we may need to spend some time trying to fix this upstream ourselves... 🤔

@batpigandme
Copy link
Contributor Author

batpigandme commented Dec 18, 2024

This requires an upstream library fix.

Yeah, there are actually three related upstream issues that all apply to Quarto as well (wherever algolia search is used). In addition to the one we’ve already linked to (algolia/autocomplete#963), there’s
algolia/autocomplete#589, and algolia/autocomplete#588 (the focus trap is also a WCAG problem, it’s just not caught in an automatic a11y audit).

Algolia has some good content on accessibility (e.g. Web content accessibility guidelines (WCAG): how to make site search work for people with disabilities), so if you can find an in, you might be able to get some traction.

@cscheid cscheid removed this from the v1.7 milestone Apr 4, 2025
@cscheid cscheid added this to the v1.8 milestone Apr 4, 2025
@cscheid
Copy link
Collaborator

cscheid commented Apr 4, 2025

We're still dependent on algolia to fix this, but since the library is open source, we've decided to attempt a PR there during 1.8.

@cscheid
Copy link
Collaborator

cscheid commented May 15, 2025

Closed by #12730. (We left a PR upstream, but patched our distribution locally.)

@cscheid cscheid closed this as completed May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility bug Something isn't working search upstream Bug is in upstream library
Projects
None yet
Development

No branches or pull requests

7 participants