Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Improved `htmlIdGenerator` when supplying both `prefix` and `suffix` ([#3076](https://github.com/elastic/eui/pull/3076))
- Updated pagination prop descriptions for `EuiInMemoryTable` ([#3142](https://github.com/elastic/eui/pull/3142))
- Added title and aria attributes to `EuiToken`'s icon element ([#3195](https://github.com/elastic/eui/pull/3195))
Comment thread
cchaos marked this conversation as resolved.
Outdated

## [`22.2.0`](https://github.com/elastic/eui/tree/v22.2.0)

Expand Down
2 changes: 1 addition & 1 deletion src/components/token/__snapshots__/token.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

exports[`EuiToken is rendered 1`] = `
<span
aria-label="aria-label"
class="euiToken euiToken--gray euiToken--circle euiToken--light euiToken--small testClass1 testClass2"
data-test-subj="test subject string"
>
<div
aria-label="aria-label"
data-euiicon-type="dot"
/>
</span>
Expand Down
20 changes: 19 additions & 1 deletion src/components/token/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ export interface TokenProps {
* Size of the token
*/
size?: TokenSize;
/**
* What would typically be the icon's title. Required for accessibility.
Comment thread
cchaos marked this conversation as resolved.
Outdated
*/
title?: string;
'aria-label'?: string;
'aria-labelledby'?: string;
'aria-describedby'?: string;
}

export type EuiTokenProps = CommonProps &
Expand All @@ -103,6 +110,10 @@ export const EuiToken: FunctionComponent<EuiTokenProps> = ({
size = 's',
style = {},
className,
title,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby,
'aria-describedby': ariaDescribedby,
...rest
}) => {
// Set the icon size to the same as the passed size
Expand Down Expand Up @@ -171,7 +182,14 @@ export const EuiToken: FunctionComponent<EuiTokenProps> = ({

return (
<span className={classes} style={style} {...rest}>
<EuiIcon type={iconType} size={finalSize} />
<EuiIcon
type={iconType}
size={finalSize}
title={title}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby}
aria-describedby={ariaDescribedby}
/>
</span>
);
};