* - Lang - Incorrect or Missing xml:lang Attribute for XML Documents

What the issue is

While the 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:

  1. Users relying on assistive technologies that interpret content based on the specified language.
  2. 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

  1. For XML-based documents and elements within XHTML, use the xml:lang attribute to specify the document's language accurately.
  2. Ensure consistency between the lang and xml:lang attributes when both are used, particularly in XHTML documents where assistive technologies may rely on one or the other.
  3. Regularly validate XML and XHTML documents to confirm the correct use of the xml:lang attribute and identify any discrepancies with the lang attribute.
Ticket category