question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inputs do not conform to accessibility standards

See original GitHub issue

Describe the bug 🐛

The default inputs in components such as SearchBox and SortBy do not allow an aria-label property. Default values or this prop interface should be available by default without having to use connectSearchBox.

Not only does this hurt a site’s Lighthouse score, but most importantly it degrades the experience of our friends who rely on accessibility attributes in HTML.

To Reproduce 🔍

See Algolia’s CodeSandbox demo. Examine the inputs with your browser’s dev tools.

I’ve also tried passing the aria-label as a prop to the component but it looks like it’s ignored. No documentation indicates that this prop is featured. An id prop also doesn’t pass through to the input to execute a different accessibility method.

Expected behavior 💭

It looks like an aria-label was added back in 2017 according to https://github.com/algolia/react-instantsearch/issues/43, but I haven’t looked in the commit history or git blame.

Additional context

See w3.org web accessibility tutorial for more information about the aria-label approach.

While an answer to this bug report may just be to use connectSearchBox, I don’t think it’s the right answer. There are even Algolia sites that don’t comply with basic input accessibility standards (1 2). Setting generic search defaults or making this prop more readily available on components such as SearchBox will help spread accessibility usage.

Let’s make accessibility a priority on the web. Thank you for maintaining a great project!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Haroenvcommented, Nov 6, 2019

Note that with the connectors, we don’t render any dom, it’s all done by users, so they can easily spread the props themselves if that’s something required. We don’t do that in the native components, since most of them have multiple dom elements inside, so it isn’t obvious to where things should be spread.

1reaction
brettinternetcommented, Oct 30, 2019

I agree that the translations object is a great candidate for this sort of thing, and including an ‘aria-label’ field for components that don’t at least have a label would be a great starting point.

@websocket98765 Could you describe the bit about ToggleRefinement? It looks like the toggle passes Lighthouse in the component example, because there’s a label for the input.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inputs do not conform to accessibility standards #2863 - GitHub
Describe the bug The default inputs in components such as SearchBox and SortBy do not allow an aria-label property.
Read more >
Web Content Accessibility Guidelines (WCAG) 2.1 - W3C
The publication of WCAG 2.1 does not deprecate or supersede WCAG 2.0. While WCAG 2.0 remains a W3C Recommendation, the W3C advises the...
Read more >
Forms | Accessibility Guidelines
The US Design Standards advise: “For example, use one input for [each] phone number, not three (not one for area code, one for...
Read more >
<input>: The Input (Form Input) element - HTML
The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide...
Read more >
Guide to Accessible Web Design & Development
This guide recaps relevant Web Content Accessibility Guidelines (WCAG)requirements and calls ... Best Practice: Do not play any audio content automatically.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found