Skip to content

Handling of Unknown and Invalid Language Tags #2294

@WilcoFiers

Description

@WilcoFiers

Accessibility support

There are differences in how assistive technologies handle unknown and invalid language tags. Some will default to the language of the page, whereas others will default to the closest ancestor with a valid lang attribute.

ACT Rules

Test cases

Test case 1

Testing handling of invalid and unknown language tags

<html lang="en">
	<!-- Valid language tag -->
	<p lang="fr">Bonjour le monde!</p>

	<!-- Invalid language tag -->
	<p lang="french">Hello World!</p>

	<!-- Unknown language tag -->
	<p lang="xyz">Hello World!</p>

	<!-- Nested invalid within valid -->
	<div lang="es">
		<p>¡Hola Mundo!</p>
		<p lang="spanish">¡Hola!</p>
	</div>

	<!-- Invalid parent with valid child -->
	<div lang="invalid-tag">
		<p>Some text</p>
		<p lang="de">Hallo Welt!</p>
	</div>

	<!-- Empty language tag -->
	<p lang="">Hello World!</p>

	<!-- Malformed language tag -->
	<p lang="en-">Hello World!</p>
</html>

Test case

Test instructions

  1. Load the test case in different browsers
  2. Test with different assistive technologies
  3. For each scenario, check:
    • How the language is announced
    • What language voice/accent is used
    • If it falls back to page language
    • If it inherits from valid ancestors
  4. Expected results:
    • Valid tags should be announced correctly
    • Invalid tags should be handled consistently
    • Inheritance from ancestors should work
    • Fallback behavior should be predictable

External links

Test results

Please report test results in a comment below. Please use the following format:

## Test case 1

- Date: ...
- Operating system: ..., version ...
- Browser: ..., version ...
- Assistive technology: ..., version ...
- Results for each scenario:
  1. Valid tag (fr): ... (announced/voice used)
  2. Invalid tag (french): ... (fallback behavior)
  3. Unknown tag (xyz): ... (fallback behavior)
  4. Nested invalid in valid: ... (inheritance behavior)
  5. Invalid parent with valid child: ... (inheritance behavior)
  6. Empty tag: ... (fallback behavior)
  7. Malformed tag: ... (fallback behavior)
- Fallback consistency: ... (consistent/inconsistent)
- Inheritance behavior: ... (working/not working)
- Test result: Passed / Failed (if failed, how was it different from expected?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibility supportAccessibility support testing and tracking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions