html-xml-lang-mismatch
O que ela faz
Esta skill verifica os atributos de idioma do elemento html de uma página. É para desenvolvedores de páginas XHTML ou de páginas que precisam funcionar como HTML e XML ao mesmo tempo.
Quando usar
- ✓Quando uma página define lang e xml:lang com valores diferentes.
- ✓Quando leitores de tela pronunciam o texto com a voz de idioma errada.
- ✓Quando você publica um documento no estilo XHTML ou EPUB.
Link da skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/html-xml-lang-mismatch/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode verificar se os atributos de idioma da minha página batem?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente verifica o elemento html quanto a lang e xml:lang e confirma que os dois valores são o mesmo código de idioma válido. Ele sinaliza qualquer divergência, incluindo diferenças em subtags como en e en-US.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Match lang and xml:lang attributes
Screen readers use the lang attribute to select the correct voice profile and pronunciation engine. If lang and xml:lang disagree, XML-based processors (including some EPUB readers and older assistive technologies) may use xml:lang and get a different language than intended — causing text to be read aloud in the wrong language. For example, French text read with an English voice profile produces unintelligible output for French-speaking blind users.
Quick Reference
- If both
langandxml:langare present on<html>, their values must be identical xml:langis only needed for XHTML or polyglot documents (valid as both HTML and XML)- For standard HTML5 documents, only
langis required —xml:langis redundant - The primary language tag must be a valid BCP 47 language code (e.g.,
en,en-US,fr,zh-Hant) - Relates to WCAG 2.1 SC 3.1.1 (Language of Page)
Check
Inspect the <html> element for both lang and xml:lang attributes. If both are present, verify their values are identical (including subtags — en vs en-US is a mismatch). Also verify that the value is a valid BCP 47 language tag. Flag if the values differ in any way.
Fix
If lang and xml:lang are present but differ: update both to the same valid BCP 47 language code matching the primary language of the document content. If this is a standard HTML5 document (served as text/html), remove xml:lang — it is unnecessary. If this is XHTML or a polyglot document, keep both and ensure they are identical.
Explain
WCAG 2.1 SC 3.1.1 requires that the default human language of each web page can be programmatically determined. The lang attribute on <html> serves this purpose for HTML parsers. The xml:lang attribute serves the same purpose for XML parsers. When a document must be valid as both HTML and XML (polyglot), both attributes must be present and identical. A mismatch means the document claims different languages depending on which parser reads it, which can cause screen readers, translation tools, and spell checkers to use wrong language rules.
Code Review
Review the rendered markup and interactive states that affect Match lang and xml:lang attributes. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/accessibility/html-xml-lang-mismatch
Perguntas frequentes
Páginas HTML5 padrão precisam de xml:lang?
Não. A skill diz que páginas HTML5 padrão precisam apenas de lang, já que xml:lang é redundante nelas.
Por que a divergência importa?
Algumas ferramentas XML e tecnologias assistivas mais antigas podem ler o xml:lang, o que pode indicar o idioma errado.
Qual norma ela cita?
Ela cita o critério de sucesso 3.1.1 do WCAG 2.1, a regra de Idioma da Página.
Detalhes
Descrição original do autor
Use when applies to XHTML documents and polyglot HTML documents that must parse correctly as both HTML5 and XML. For modern HTML5-only documents, only `lang` is needed and `xml:lang` is not required. Check when auditing documents served as application/xhtml+xml or documents that include both attributes.
Popularidade
- Estrelas no GitHub
- 75 mil
- Posição no ranking
- #2873
- Licença
- MIT
- Atualizada em
- 31/10/2026
Comentários
- …
Mais skills deste repositório
frontendchecklist
75 milVerifica código front-end e páginas no ar contra mais de 380 regras de acessibilidade, velocidade, SEO e segurança, usando uma ferramenta de linha de comando.
frontend-checklist-global
75 milAudita um projeto front-end contra todas as 386 regras do Front-End Checklist e dá uma correção específica para cada problema encontrado.
404-page
75 milVerifica se a sua página de conteúdo não encontrado oferece links úteis e retorna um status 404 real, para ajudar visitantes perdidos a encontrar o caminho.
about-page
75 milRevisa se o seu site tem uma página Sobre clara que explica quem está por trás dele, para criar confiança em visitantes e buscadores.
Skills parecidas
angular-developer
280 milAjuda seu agente a criar código Angular e a dar conselhos sobre a estrutura do projeto. É útil para iniciar novos projetos, criar partes do código ou melhorar a performance e acessibilidade.
frontend-a11y
280 milAjuda seu agente a tornar interfaces web acessíveis para todos. Ele garante que sites e apps funcionem bem com leitores de tela e navegação por teclado.
frontend-patterns
280 milFaz seu agente aplicar padrões modernos no desenvolvimento frontend. Ele otimiza performance, gerencia estado e segue boas práticas em React e Next.js.