What the issue is
lang attribute is used in HTML to indicate the language of the page or parts thereof, XML-based documents, such as SVG or XHTML, should use the
xml:lang attribute for this purpose. When
xml:lang is missing, incorrect, or inconsistent with the HTML
lang attribute in XHTML documents, it can lead to confusion for assistive technologies, affecting the document's accessibility.
Why this is important
Correct language identification is crucial for assistive technologies to process and interpret content accurately. This includes proper pronunciation by screen readers, correct handling of directionality in bi-directional languages, and ensuring that language-specific user interface controls are correctly labeled. Misidentification or lack of language specification in XML-based documents can hinder content accessibility and lead to a poor user experience for people with disabilities.
Who it affects
This issue primarily affects:
- Users relying on assistive technologies that interpret content based on the specified language.
- Users who interact with XML-based documents or web applications that incorporate XML content, such as SVG images or XHTML documents.
How to remediate the issue
- For XML-based documents and elements within XHTML, use the
xml:langattribute to specify the document's language accurately.
- Ensure consistency between the
xml:langattributes when both are used, particularly in XHTML documents where assistive technologies may rely on one or the other.
- Regularly validate XML and XHTML documents to confirm the correct use of the
xml:langattribute and identify any discrepancies with the