Skip to content

Commit f623fc9

Browse files
docs(api): add accessibility section for icons (#2807)
1 parent b44c54d commit f623fc9

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

docs/api/icon.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,28 @@ For more information, including styling and all available icons, see <a href="ht
1818

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

21-
<Basic />
21+
<Basic />
22+
23+
24+
## Accessibility
25+
26+
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.
27+
28+
```html
29+
<ion-icon name="heart" aria-hidden="true"></ion-icon>
30+
```
31+
32+
33+
If the icon is interactive, it should have alternate text defined by adding an <code>aria-label</code>.
34+
35+
```html
36+
<ion-icon name="heart" aria-label="Favorite"></ion-icon>
37+
```
38+
39+
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>.
40+
41+
```html
42+
<ion-button aria-label="Favorite">
43+
<ion-icon name="heart" aria-hidden="true"></ion-icon>
44+
</ion-button>
45+
```

0 commit comments

Comments
 (0)