algolia / algolia/autocomplete

Lighthouse report and accessibility

Open
#963 4 comments 0 reactions 0 assignees View on GitHub
Scope: Accessibility Scope: Detached mode
Dominant language
TypeScript
Stars
5.3k
Forks
341
Avg merge
3d 1h
Merged PRs (30d)
5

Description

## Description

Running a Lighthouse report for mobile on the [playground](https://codesandbox.io/s/github/algolia/autocomplete/tree/next/examples/playground) (opened in a new window) returns this warning about a missing accessible name:

image

Getting the same [on my own site](https://bilingueanglais.com/) 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

- OS: macOS
- Browser: Brave [Version 1.38.109 Chromium: 101.0.4951.41 (Official Build) (arm64)](https://brave.com/latest/)
- Autocomplete version: 1.6.2

## Added bonus...

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

Contributor guide

Open the contributing guide

Research direction

Open the linked playground and run Lighthouse in its mobile configuration, then inspect the empty-state DOM around .aa-Autocomplete and autocomplete-0-label. Compare it with the desktop and populated-results states. Done means the label exists whenever the autocomplete exists and the Lighthouse accessible-name warning is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
accessibility
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.