Skip to content

Lighthouse report and accessibility  #963

Open

Description

@fabswt

Description

Running a Lighthouse report for mobile on the playground (opened in a new window) returns this warning about a missing accessible name:

image

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.
  • the warning from Lighthouse to be gone.

Environment

Added bonus...

...the joy and satisfaction of knowing you'll help me reach a score of 100 on Accessibility 😁
image

Activity

  1. Haroenv commented on May 2, 2022

    @Haroenv
    Contributor

    Here's the relevant part of the code:

    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

  2. sarahdayan commented on May 16, 2022

    @sarahdayan
    Contributor

    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.

  3. signekb commented on Jun 13, 2024

    @signekb

    Hi!
    I found the issue on quarto-dev/quarto-cli#678 and was wondering what the status is on this?

  4. srvanderplas commented on Dec 18, 2024

    @srvanderplas

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions