Skip to content

Commit

Permalink
fix(List): Hide SVGs from assistive tech by adding `aria-hidden="true…
Browse files Browse the repository at this point in the history
…"` to the `span` element that wraps the SVGs. (#1516)

Co-authored-by: Nikita Orliak <[email protected]>
  • Loading branch information
nikitaorliak-cengage and Nikita Orliak authored Oct 25, 2024
1 parent 2a6ba19 commit 08deb43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/a11y-list-hide-icons-from-assistive-tech.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-magma-dom': patch
---

fix(List): Hide SVGs from assistive tech by adding `aria-hidden="true"` to the `span` element that wraps the SVGs.
4 changes: 4 additions & 0 deletions packages/react-magma-dom/src/components/List/List.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ describe('List', () => {
'borderRadius',
'50%'
);
expect(container.querySelector('span')).toHaveAttribute(
'aria-hidden',
'true'
);
});

it('should render a list item with a small icon', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-magma-dom/src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const ListItem = React.forwardRef<HTMLDivElement, ListItemProps>(
}
iconColor={theme.colors[iconColor] || theme.colors.neutral100}
theme={theme}
aria-hidden="true"
>
{icon}
</StyledIcon>
Expand Down

2 comments on commit 08deb43

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sign in to comment.