Skip to content

Commit 65ef1ef

Browse files
docs(usage): add accessibility section (#31)
1 parent a50b079 commit 65ef1ef

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/components/usage-page/content.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,30 @@ export default function (version: string, name = "heart", suffix = "") {
132132
}`
133133
)}
134134

135+
<h2>Accessibility</h2>
136+
<p>
137+
Icons that are purely decorative content should have <code>aria-hidden="true"</code>.
138+
This will not visually hide the icon, but it will hide the element from assistive technology.
139+
</p>
140+
{highlight(`<ion-icon name="heart" aria-hidden="true"></ion-icon>`)}
141+
142+
<p>
143+
If the icon is interactive, it should have alternate text defined by adding an
144+
<code>aria-label</code>.
145+
</p>
146+
{highlight(`<ion-icon name="heart" aria-label="Favorite"></ion-icon>`)}
147+
148+
<p>
149+
Alternatively, if the icon is inside of another element that it is describing, that element
150+
should have the <code>aria-label</code> added to it, and the icon should be hidden using
151+
<code>aria-hidden</code>.
152+
</p>
153+
{highlight(
154+
`<ion-button aria-label="Favorite">
155+
<ion-icon name="heart" aria-hidden="true"></ion-icon>
156+
</ion-button>`
157+
)}
158+
135159
<h2>Migrating from v4</h2>
136160
<p>
137161
See the{" "}

0 commit comments

Comments
 (0)