Match lang subtags Screen reader compatibility

HTML WCAG
Dec 12, 2023

Expected Result: works in a screen reader

Actual Result: causes problems in 6 screen reader / browser combinations

In English 'active table' is pronounced 'act-if tay-bill'. In French 'active table' is pronounced 'act-eef tab-le'. In English 'radio' is pronounced 'ray-day-oh'. In French 'radio' is pronounced 'rad-yoh'. In German 'radio' is pronounced 'rah-di-oh'. In English 'dame' is pronounced 'daim'. In French 'dame' is pronounced 'damm'. In German 'dame' is pronounced 'dam-he'.

By default NVDA uses Windows OneCore voices, which only support language switching if the appropriate Windows language pack is installed. When the German (Germany) language pack is installed lang=de and lang=de-DE are voiced as German, but lang=de-AT is voiced as English. When the French (France) language pack is installed lang=fr and lang=fr-FR voiced as French, but lang=fr-CA is voiced as English.

Changing NVDA settings to use the eSpeak voice allows language switching without additional language packs (so lang=de, lang=de-DE and lang=de-AT are all voiced as German, but sound more robotic than the OneCore voices).

WCAG Technique: WCAG 3.1.1 WCAG 3.1.2

Code used for this test:


		<html lang='fr'>
		<head> 
			<title lang='en'>Test for lang subtag matches</title>
			<link rel='stylesheet' href='SR-content-lang.css'>
		</head>
		<body>
			<h1 lang='en'>Following elements have different variants of German: de, de-DE and de-AT</h1>
			<p lang='de'>dame</p>
			<p lang='de-DE'>dame</p>
			<p lang='de-AT'>dame</p>
		</body>
		</html>
	

Reliability Trend

This graph shows reliability over time for this code in NVDA, JAWS and Voiceover. Other screen readers don't have enough historical data yet to plot trends.

100%80%60%40%20%0%2015201620172018201920202021202263%202363%

Change History

Last updated: December 12, 2023

  • Bad NVDA with Chrome Causes problems from NVDA 2022.2 to NVDA 2023.3
  • Bad NVDA with FF Causes problems from NVDA 2022.2 to NVDA 2023.3
  • Good JAWS with Chrome Stable - OK from JAWS 2022.2207.25 to JAWS 2023.2311.34
  • Good JAWS with FF Stable - OK from JAWS 2022.2207.25 to JAWS 2023.2311.34
  • Good VoiceOver macOS Stable - OK from VoiceOver macOS 12.5 to VoiceOver macOS 13.6
  • Good VoiceOver iOS Stable - OK from VoiceOver iOS 15.6 to VoiceOver iOS 16.6
Screen readerBrowserModeNotesWhat the user hears
Fail NVDA 2023.3Chrome 120 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
Fail NVDA 2023.3FF 115 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
Fail NVDA 2023.3Edge 120 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
Fail NVDA 2022.2Chrome 105 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
Fail NVDA 2022.2FF 102 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
Fail NVDA 2022.2Edge 105 Reading lang=de and lang=de-DE pronounced as German, lang=de-AT pronounced as English. Dam-he. Dam-he. Daim.
OK JAWS 2023.2311.34Chrome 120 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK JAWS 2023.2311.34FF 115 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK JAWS 2023.2311.34Edge 120 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK JAWS 2022.2207.25Chrome 105 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK JAWS 2022.2207.25FF 102 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK JAWS 2022.2207.25Edge 105 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK VoiceOver macOS 13.6Safari 16.6 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK VoiceOver macOS 12.5Safari 15.6 Reading All pronounced as German. Dam-he. Dam-he. Dam-he.
OK VoiceOver iOS 16.6Safari iOS 16.6TouchAll pronounced as German. Dam-he. Dam-he. Dam-he.
OK VoiceOver iOS 15.6Safari iOS 15.6TouchAll pronounced as German. Dam-he. Dam-he. Dam-he.

SortSite rules: AccPageLangMissing AccPhraseLangMissing

Test notes

All tests were carried out with screen reader factory settings. JAWS in particular has a wide variety of settings controlling exactly what gets spoken.

Screen readers allow users to interact in different modes, and can produce very different results in each mode. The modes used in these tests are:

  • Reading Content read using the “read next” command in a screen reader
  • Tabbing Content read using the “tab” key in a screen reader
  • Heading Content read using the “next heading” key in a screen reader
  • Touch Content read when touching an area of screen on a mobile device

In the “What the user hears” column:

  • Commas represent short pauses in screen reader voicing
  • Full Stops represent places where voicing stops, and the “read next” or “tab” or “next heading” command is pressed again
  • Ellipsis … represent a long pause in voicing
  • (Brackets) represent voicing that requires a keystroke to hear