Fix: Accessible name mismatch for AI Chat button #3934
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an accessibility violation on website doc page where the accessible name of the AI Chat button did not match its visible label, as reported by the IBM Equal Access Accessibility Checker.
The issue occurred because the button’s accessible name was implicitly derived from a non-string label prop (a JSX node), which resulted in an incorrect or opaque accessible name (e.g.
[object Object]). This caused screen readers and a11y tools to report a mismatch between the visible label and the accessible name.Solution
Explicitly set a string-based accessible name using the
aria-labelprop.Keep the existing
labelprop for tooltip / visual rendering only.<Button iconOnly={!showLabel || isMobile} size="medium" variant="header" label={ + aria-label={t(language, 'ai_chat_ask', assistant.label)} // Explicit accessible name string <div className="flex items-center gap-2"> {t(language, 'ai_chat_ask', assistant.label)} {withShortcut ? (This ensures:
Testing
The patch submitted in this PR was generated by A11YRepair, an automated Web Accessibility repair tool that I developed to address common accessibility violations in web applications. The generated fixes were manually reviewed and validated before submission.
The fix has been manually verified in the following locales:
✅ English



✅ Chinese
✅ French