Skip to content

fix(search): update search landmark labeling to use aria-labelledby#22347

Merged
kennylam merged 4 commits into
carbon-design-system:mainfrom
kennylam:fix/search-component-a11y-fixes
Jun 1, 2026
Merged

fix(search): update search landmark labeling to use aria-labelledby#22347
kennylam merged 4 commits into
carbon-design-system:mainfrom
kennylam:fix/search-component-a11y-fixes

Conversation

@kennylam

Copy link
Copy Markdown
Member

Closes #12360

This changes the search landmark to use aria-labelledby instead of aria-label. The new reference points to the existing label element that contains the required labelText prop. This approach enforces unique labels and labelText values for each search component used on the page.

Changelog

New

  • add test to verify that search component landmarks are unique

Changed

  • search component landmarks now use aria-labelledby rather than aria-label

Testing / Reviewing

  • view the default Search story
  • inspect the component and verify <div role="search"> has aria-labelledby pointing to the label's ID
  • the label's ID should match the aria-labelledby value
  • Search tests should pass

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • [ ] Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@kennylam kennylam requested a review from a team as a code owner May 30, 2026 21:12
@kennylam kennylam changed the title Fix/search component a11y fixes fix(search): update search landmark labeling to use aria-labelledby May 30, 2026
@netlify

netlify Bot commented May 30, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit fd8208e
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6a1ce373aa410f000826cffd
😎 Deploy Preview https://deploy-preview-22347--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 30, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fd8208e
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6a1ce37396f043000875b008
😎 Deploy Preview https://deploy-preview-22347--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 30, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fd8208e
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6a1ce373dcca69000813c073
😎 Deploy Preview https://deploy-preview-22347--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.50%. Comparing base (fdd6ce7) to head (fd8208e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22347      +/-   ##
==========================================
- Coverage   95.53%   95.50%   -0.03%     
==========================================
  Files         582      582              
  Lines       50472    50472              
  Branches     6810     6785      -25     
==========================================
- Hits        48218    48204      -14     
- Misses       2121     2135      +14     
  Partials      133      133              
Flag Coverage Δ
main-packages 89.23% <ø> (ø)
web-components 98.07% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maradwan26 maradwan26 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maradwan26 maradwan26 added this pull request to the merge queue Jun 1, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 1, 2026
@kennylam kennylam added this pull request to the merge queue Jun 1, 2026
Merged via the queue into carbon-design-system:main with commit 37dff96 Jun 1, 2026
39 of 40 checks passed
@kennylam kennylam deleted the fix/search-component-a11y-fixes branch June 1, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[a11y]: Search component labelling causing some potential failures

3 participants