Skip to content

Understand · beginner level

Page title and language

The first two things a screen reader gives when a page opens: its title and the language it reads it in.

Updated on

When a person opens a page with a screen reader, the software first announces the page title, then reads the content with the voice of the language the page declares. Both pieces of information come from two lines of code nobody sees on screen: the title element, in the head, and the lang attribute of the html element.

The page title

Two criteria apply.

RGAA criterion 8.5 (French original): Chaque page web a-t-elle un titre de page ? WCAG 2.2: 2.4.2 Page Titled (Level A).

RGAA criterion 8.6 (French original): Pour chaque page web ayant un titre de page, ce titre est-il pertinent ? WCAG 2.2: 2.4.2 Page Titled (Level A).

For the RGAA glossary, the page title is the content of the title element, which must identify the page clearly, concisely and uniquely. You read it in the browser tab, in the history and in bookmarks. The large visible heading, often an h1, titles the content; it does not replace the title element.

Example: a title that names the page and the site

Browser tab: “Opening hours – Linden Library”

Opening hours

Tuesday to Saturday, 10 am to 7 pm.

Code

<head>
  <title>Opening hours - Linden Library</title>
</head>

Compliant. The page has a title, and the title says which page and which site this is. A person with ten tabs open finds this one without hesitating.

Example: a page with no title element

Browser tab: the page address, for lack of a title

Opening hours

Tuesday to Saturday, 10 am to 7 pm.

Code

<head>
  <meta charset="utf-8">
</head>
<body>
  <h1>Opening hours</h1>

Non-compliant. The h1 does not count as a page title. Without a title element, the tab shows the address, and the screen reader announces no title on arrival: the person has to read the content to know where they are.

Example: a title left at its default value

Browser tab: “Untitled”

Opening hours

Tuesday to Saturday, 10 am to 7 pm.

Code

<title>Untitled</title>

Non-compliant. The page does have a title element, so criterion 8.5 is met. But “Untitled”, an editor’s default text, says nothing about the page: the title is not relevant under criterion 8.6. A file name such as “index.html” or an empty element cause the same problem.

Example: a title that flags an error

Browser tab: “Error – Step 2 of 3: contact details – Registration – Linden Library”

Your contact details

The “Email” field is filled in incorrectly.

Code

<title>Error - Step 2 of 3: contact details - Registration - Linden Library</title>

Compliant. After the form is submitted, the screen reader announces this title as soon as the page reloads: the person immediately knows an error is waiting, which step they are at and which site they are on.

The page language

RGAA criterion 8.3 (French original): Dans chaque page web, la langue par défaut est-elle présente ? WCAG 2.2: 3.1.1 Language of Page (Level A).

The RGAA glossary talks about the main processing language of the document. In HTML5, you declare it with the lang attribute, usually on the html element. The screen reader’s speech synthesiser uses it to choose its pronunciation.

Example: an English page, declared in English

Our events

Every Wednesday, a story time for 4 to 8 year olds.

Code

<html lang="en">

Compliant. lang="en" announces English: the speech synthesiser reads “story time” with English pronunciation.

Example: an empty lang attribute

Our events

Every Wednesday, a story time for 4 to 8 year olds.

Code

<html lang="">

Non-compliant. The attribute is there but empty: it gives no language, as if it were missing. The speech synthesiser then reads the text with the language set on the person’s device, which may not be English.

Checking a page in a few seconds

Display the page source (Ctrl+U in most browsers) and read the first lines. Look for the html element and its lang attribute, then the title element in the head. Then read the title as if you could only see the tab: does it tell you where you are?

Key points

  • The page title is the title element in the head. The h1 does not replace it.
  • A good title names the page, then the site, and flags an error or a step when there is one.
  • The language is declared on the html element, with a filled-in lang attribute, for instance lang="en".

To practise: the quiz “Page title and language”.