Skip to content

Commit

Permalink
docs(api): add accessibility section for icons (#2807)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyscarney authored Mar 6, 2023
1 parent b44c54d commit f623fc9
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion docs/api/icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,28 @@ For more information, including styling and all available icons, see <a href="ht

import Basic from '@site/static/usage/v7/icon/basic/index.md';

<Basic />
<Basic />


## Accessibility

Icons that are purely decorative content should have <code>aria-hidden="true"</code>. This will not visually hide the icon, but it will hide the element from assistive technology.

```html
<ion-icon name="heart" aria-hidden="true"></ion-icon>
```


If the icon is interactive, it should have alternate text defined by adding an <code>aria-label</code>.

```html
<ion-icon name="heart" aria-label="Favorite"></ion-icon>
```

Alternatively, if the icon is inside of another element that it is describing, that element should have the <code>aria-label</code> added to it, and the icon should be hidden using <code>aria-hidden</code>.

```html
<ion-button aria-label="Favorite">
<ion-icon name="heart" aria-hidden="true"></ion-icon>
</ion-button>
```

1 comment on commit f623fc9

@vercel
Copy link

@vercel vercel bot commented on f623fc9 Mar 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ionic-docs – ./

ionic-docs-ionic1.vercel.app
ionic-docs-gqykycf8t.vercel.app
ionic-docs-git-main-ionic1.vercel.app

Please sign in to comment.