Skip to content

[a11y]: ExpandableSearch element: unnecessary inclusion of aria-label="button" attribute #19516

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

Open
1 of 2 tasks
samcraftt opened this issue May 29, 2025 · 0 comments · May be fixed by #19532
Open
1 of 2 tasks

[a11y]: ExpandableSearch element: unnecessary inclusion of aria-label="button" attribute #19516

samcraftt opened this issue May 29, 2025 · 0 comments · May be fixed by #19532
Assignees
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 🐛

Comments

@samcraftt
Copy link

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 an aria-label="button" attribute, as well as an aria-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 the ExpandableSearch element.

However, according to this documentation, you are not to use both aria-label and aria-labelledby on the same element, because aria-labelledby will take precedence over aria-label if both are applied.

aria-label and aria-labelledby are not fields we can manually set, according to Carbon's documentation, so the attributes aria-label and aria-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 an aria-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 the ExpandableSearch 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 and aria-labelledby attributes are provided even though I don't set them in the code.

Suggested Severity

None

Code of Conduct

@github-actions github-actions bot added the adopter: strategic-product Work-stream that directly effects the Product-led Growth initiative. label May 29, 2025
@maradwan26 maradwan26 self-assigned this May 30, 2025
@maradwan26 maradwan26 added severity: 3 https://ibm.biz/carbon-severity role: dev 🤖 component: select a11y: VoiceOver Screen reader issues, specifically Voiceover package: @carbon/react @carbon/react platform: macos and removed status: needs triage 🕵️‍♀️ labels May 30, 2025
@maradwan26 maradwan26 moved this to 🚦 In Review in Design System May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 🐛
Projects
Status: 🚦 In Review
Development

Successfully merging a pull request may close this issue.

2 participants