Dostępność

a11y/html-lang

The html element names the language of the page in a non-empty lang attribute.

poważnastatyczneWCAG 3.1.1 · Afe-html

Dlaczego

Screen readers choose their pronunciation from lang; without it the text is read with the user's default voice and can be unintelligible. Browsers also use it for hyphenation, translation and font selection.

Poprawka

Put a BCP 47 language tag on the root element: <html lang="en">, <html lang="pl">. In Next.js set it in the root layout, in Astro in the layout, in SvelteKit in src/app.html. Mark passages in another language with their own lang.

Przykłady

<!-- bad -->
<html>
<!-- good -->
<html lang="en">

Źródła

Fakty

Identyfikator
a11y/html-lang
Waga
poważna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html astro jsx svelte
WCAG 2.2
3.1.1, poziom A
Ten sam problem w
axe-core html-has-lang, axe-core html-lang-valid
Uczy jej skill
fe-html HTML documents and semantics
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/html-lang