Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/9133.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Accessibility**

- Fixes accessibility violation by adding an `aria-label` to `EuiBetaBadge` span with `role="button"`
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ exports[`EuiBetaBadge props tooltip and anchorProps are rendered 1`] = `
data-test-subj="DTS"
>
<span
aria-label="Beta"
class="euiBetaBadge emotion-euiBetaBadge-hollow-m-baseline"
role="button"
tabindex="0"
Expand Down
8 changes: 8 additions & 0 deletions packages/eui/src/components/badge/beta_badge/beta_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ export const EuiBetaBadge: FunctionComponent<EuiBetaBadgeProps> = ({
}
} else {
if (tooltipContent) {
// Ensure every ARIA button, has an accessible name
const ariaLabel = (() => {
if (title) return title;
if (typeof label === 'string') return label;
return undefined;
})();

return (
<EuiToolTip
position={tooltipPosition}
Expand All @@ -236,6 +243,7 @@ export const EuiBetaBadge: FunctionComponent<EuiBetaBadgeProps> = ({
role="button"
css={cssStyles}
className={classes}
aria-label={ariaLabel}
{...rest}
>
{icon || label}
Expand Down