[a11y]: ExpandableSearch element: unnecessary inclusion of aria-label="button"
attribute
#19516
Open
1 of 2 tasks
Labels
a11y: VoiceOver
Screen reader issues, specifically Voiceover
adopter: strategic-product
Work-stream that directly effects the Product-led Growth initiative.
component: select
package: @carbon/react
@carbon/react
platform: macos
role: dev 🤖
severity: 3
https://ibm.biz/carbon-severity
type: a11y ♿
type: bug 🐛
Package
@carbon/react
Browser
Chrome
Operating System
MacOS
Package version
1.78.0
React version
18.3.1
Automated testing tool and ruleset
IBM Equal Access Accessibility Checker - Latest Deployment
Assistive technology
MacOS Voiceover
Description
In IBM OpenPages, we use Carbon's
ExpandableSearch
element. The search icon, which serves as a button to expand the search bar, must have an appropriate label attribute to pass the accessibility checker, which it does. In fact, there are two attributes that, on their own, would cause the element to pass the accessibility checker. There is anaria-label="button"
attribute, as well as anaria-labelledby="search-input-:rar:-search"
, which appropriately points to a label that is fitting for this button. Therefore, we are able to pass the accessibility checker with theExpandableSearch
element.However, according to this documentation, you are not to use both
aria-label
andaria-labelledby
on the same element, becausearia-labelledby
will take precedence overaria-label
if both are applied.aria-label
andaria-labelledby
are not fields we can manually set, according to Carbon's documentation, so the attributesaria-label
andaria-labelledby
must be automatically set by Carbon.aria-labelledby
is the more appropriate attribute to include, because it allows us to point to a label that's more fitting and descriptive, whereas anaria-label
of "button" isn't informative.Lastly, though the Mozilla documentation, mentions that
aria-labelledby
will take precedence, using MacOS Voiceover when the focus is on theExpandableSearch
yields a redundant and possibly confusing explanation:"Search for field name, collapsed, button, Search for field name, search. You are currently on a button. To click this button, press Control-Option-Space."
Again, I think removing the default attribute
aria-label="button"
would solve this.WCAG 2.1 Violation
No response
Reproduction/example
https://stackblitz.com/edit/github-amzubdxd?file=src%2FApp.jsx
Steps to reproduce
It should already be reproduced. Note that the
aria-label
andaria-labelledby
attributes are provided even though I don't set them in the code.Suggested Severity
None
Code of Conduct
The text was updated successfully, but these errors were encountered: