Skip to content

HTML page has non-empty title

Description

This rule checks that a non-embedded HTML page has a non-empty title.

Applicability

This rule applies to the root element of the web page, if it is an html element.

Expectation 1

Each target element has at least one descendant that is a title element.

Expectation 2

For each target element, the first HTML title element that is a descendant of the document element has children that are text nodes that are not only whitespace.

Assumptions

This rule assumes that Success Criterion 2.4.2 Page Titled does not require that a document only has one title element, nor that it is a child of the head element of a document. While this is invalid in HTML, the HTML 5.2 specification describes what should happen in case of multiple titles, and titles outside the head element. Because of this, neither of these validation issues causes a conformance problem for WCAG. Regardless of whether this is required by 2.4.2 Page Titled, failing this rule means the success criterion is not satisfied.

This rule assumes that the title of the page is not provided by a higher-level protocol. For example, the subject field of an email authored in HTML can provide a title without requiring a title element. In such a case, this rule will fail while Success Criterion 2.4.2 Page Titled may still be satisfied.

Accessibility Support

There are no accessibility support issues known.

Background

This rule is only applicable to non-embedded HTML pages. HTML pages embedded into other documents, such as through iframe or object elements are not applicable because they are not web pages according to the definition in WCAG.

Bibliography

Accessibility Requirements Mapping

Input Aspects

The following aspects are required in using this rule.

Test Cases

These HTML files are used in several examples:

File /test-assets/sc2-4-2-title-page-without-title.html:

<html>
	<body>
		Content
	</body>
</html>

File /test-assets/sc2-4-2-title-page-with-title.html:

<html>
	<head>
		<title>Title</title>
	</head>
	<body>
		Content
	</body>
</html>

Passed

Passed Example 1

Open in a new tab

This page has a title element with content.

<html>
	<title>This page has a title</title>
</html>

Passed Example 2

Open in a new tab

This page has a title element that serves as the title for the page and the iframe since the iframe does not have its own.

<html>
	<title>This page gives a title to an iframe</title>
	<iframe src="/test-assets/sc2-4-2-title-page-without-title.html"></iframe>
</html>

Passed Example 3

Open in a new tab

This page has two title elements with content.

<html>
	<head>
		<title>Title of the page.</title>
	</head>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Passed Example 4

Open in a new tab

This page has one title element with content, which is within the body element.

<html>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Passed Example 5

Open in a new tab

This page has two title elements and only the first has content.

<html>
	<head>
		<title>Title of the page.</title>
	</head>
	<body>
		<title></title>
	</body>
</html>

Failed

Failed Example 1

Open in a new tab

This page does not have a title element.

<html>
	<h1>this page has no title</h1>
</html>

Failed Example 2

Open in a new tab

This page has a title element that is empty.

<html>
	<title></title>
</html>

Failed Example 3

Open in a new tab

This page does not have a title element. The title element in the content of the iframe does not function as the title for the entire page.

<html>
	<iframe src="/test-assets/sc2-4-2-title-page-with-title.html"></iframe>
</html>

Failed Example 4

Open in a new tab

This page has two title elements and the first is empty.

<html>
	<head>
		<title></title>
	</head>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Failed Example 5

Open in a new tab

This page has a title element that only contains a separator character.

<html>
	<title> </title>
</html>

Inapplicable

Inapplicable Example 1

Open in a new tab

This title element is a child of an svg element.

<svg xmlns="http://www.w3.org/2000/svg">
  <title>This is an SVG</title>
</svg>

Glossary

Namespaced Element

An element with a specific namespaceURI value from HTML namespaces. For example an “SVG element” is any element with the “SVG namespace”, which is http://www.w3.org/2000/svg.

Namespaced elements are not limited to elements described in a specification. They also include custom elements. Elements such as a and title have a different namespace depending on where they are used. For example a title in an HTML page usually has the HTML namespace. When used in an svg element, a title element has the SVG namespace instead.

Outcome

An outcome is a conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementations using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such “interim” results can be expressed with the incomplete outcome.

Web page (HTML)

An HTML web page is the set of all fully active documents which share the same top-level browsing context.

Note: Nesting of browsing context mostly happens with iframe and object. Thus a web page will most of the time be a “top-level” document and all its iframe and object (recursively).

Note: Web pages as defined by WCAG are not restricted to the HTML technology but can also include, e.g., PDF or DOCX documents.

Note: Although web pages as defined here are sets of documents (and do not contain other kind of nodes), one can abusively write that any node is “in a web page” if it is a shadow-including descendant of a document that is part of that web page.

Whitespace

Whitespace are characters that have the Unicode “White_Space” property in the Unicode properties list.

This includes:

Rule Versions

  1. Latest version, 31 August 2023 (compare)
    • Replace Web Page definition with HTML-specific definition
    • Add higher-level protocol assumption
  2. Previous version, 28 January 2022

Implementations

This section is not part of the official rule. It is populated dynamically and not accounted for in the change history or the last modified date.

Implementation Type Consistency Report
Alfa (fully automated) 0.80.0 Automated tool Consistent Alfa (fully automated) Report
Alfa (semi-automated) 0.80.0 Semi-automated tool Consistent Alfa (semi-automated) Report
Axe DevTools Pro 4.37.1 Semi-automated tool Consistent Axe DevTools Pro Report
Axe-core 4.8.3 Automated tool Consistent Axe-core Report
Equal Access Accessibility Checker 3.1.42-rc.0 Automated tool Consistent Equal Access Accessibility Checker Report
QualWeb 3.0.0 Automated tool Consistent QualWeb Report
SortSite 6.45 Automated tool Consistent SortSite Report
Total Validator 17.4.0 Linter Consistent Total Validator Report
Total Validator (+Browser) 17.4.0 Automated tool Consistent Total Validator (+Browser) Report
Trusted Tester 5.1 Test methodology Consistent Trusted Tester Report
Back to Top

This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.