Dostępność
a11y/iframe-title
Every visible iframe has a title that says what it contains (map, video, payment form).
poważnastatyczneWCAG 4.1.2 · Afe-a11y-core
Dlaczego
Screen readers announce an iframe by its title. Without one, people hear "frame" and must enter it to find out whether it is a video, a map or an advert, often on every page.
Poprawka
Add title with a short description of the content: title="Product video: setting up sync", title="Card payment form". Embeds from component libraries usually accept a title prop; pass it. Hide purely technical frames with hidden or aria-hidden="true" and tabindex="-1".
Przykłady
<!-- bad -->
<iframe src="https://www.youtube-nocookie.com/embed/abc123"></iframe>
<!-- good -->
<iframe src="https://www.youtube-nocookie.com/embed/abc123" title="Video: setting up sync in two minutes"></iframe>Źródła
Fakty
- Identyfikator
a11y/iframe-title- Waga
- poważna
- Sprawdzanie
- statyczne sprawdzane w kodzie źródłowym przez
audit - Dotyczy plików
htmlangularvuesvelteastrojsx- WCAG 2.2
- 4.1.2, poziom A
- Ten sam problem w
- axe-core
frame-title, Lighthouseframe-title - Uczy jej skill
fe-a11y-coreAccessibility, WCAG 2.2 map- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain a11y/iframe-title