Skip to content

Commit e245037

Browse files
authored
fix(toast): make toast icon accessible to screen readers (#3057)
* changes * Update InternalToast.tsx * fix test suite to match
1 parent 1a5c69f commit e245037

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.changeset/warm-groups-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/toast': patch
3+
---
4+
5+
Updates the Toast Icon to be labeled for screen readers

packages/toast/src/InternalToast/InternalToast.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ describe('packages/toast/internal-toast', () => {
9393

9494
describe('the correct icon is rendered', () => {
9595
const expectedVariantIcons: Record<Variant, string> = {
96-
[Variant.Success]: 'Checkmark With Circle Icon',
97-
[Variant.Note]: 'Info With Circle Icon',
98-
[Variant.Warning]: 'Warning Icon',
99-
[Variant.Important]: 'Important With Circle Icon',
100-
[Variant.Progress]: 'Refresh Icon',
96+
[Variant.Success]: 'success notification',
97+
[Variant.Note]: 'note notification',
98+
[Variant.Warning]: 'warning notification',
99+
[Variant.Important]: 'important notification',
100+
[Variant.Progress]: 'progress notification',
101101
};
102102

103103
test.each(Object.values(Variant) as Array<Variant>)(

packages/toast/src/InternalToast/InternalToast.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export const InternalToast = React.forwardRef<
100100
})}
101101
>
102102
<VariantIcon
103-
aria-hidden
103+
role="img"
104+
aria-label={`${variant} notification`}
104105
className={cx(baseIconStyle, iconThemeStyle[theme])}
105106
size={32}
106107
/>

0 commit comments

Comments
 (0)