Proposed Test Rule: HTML page title is descriptive
Applicability
This rule applies to the first HTML title
element that
- is a descendant of the
html
element of a web page, and - contains children that are text nodes that are not only whitespace.
Expectation
The target element describes the topic or purpose of the overall content of the document.
Assumptions
- This rule assumes that the language of each test target can be correctly determined (either programmatically or by analyzing the content), and sufficiently understood.
- A prerequisite for this rule is that Technique H25: Providing a title using the title element is used for living up to 2.4.2 Page Titled
Accessibility Support
- This rule assumes that browsers only recognize the first
title
element if multipletitle
elements are present in the document. Testing shows that this in general is the case. Therefore the scope of this rule is limited to only checking the firsttitle
element in a document.
Background
The title
elements of embedded documents, such as those in iframe
, object
, or svg
elements, are not applicable because those are not web pages according to the definition in WCAG.
The HTML specification - The title
element requires that a document only has one title
element, and that it is a child of the head
element of a document. However, current HTML specification also 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.
Related rules
Bibliography
- Understanding Success Criterion 2.4.2: Page titled
- Technique G88: Providing descriptive titles for Web pages
- Technique H25: Providing a title using the title element
Accessibility Requirements Mapping
2.4.2 Page Titled (Level A)
- Learn more about 2.4.2 Page Titled
- Required for conformance to WCAG 2.0 and later on level A and higher.
- Outcome mapping:
- Any
failed
outcomes: success criterion is not satisfied - All
passed
outcomes: success criterion is satisfied - An
inapplicable
outcome: success criterion needs further testing
- Any
G88: Providing descriptive titles for Web pages
- Learn more about technique G88
- Not required for conformance to any W3C accessibility recommendation.
- Outcome mapping:
- Any
failed
outcomes: technique is not satisfied - All
passed
outcomes: technique needs further testing - An
inapplicable
outcome: technique needs further testing
- Any
H25: Providing a title using the title element
- Learn more about technique H25
- Not required for conformance to any W3C accessibility recommendation.
- Outcome mapping:
- Any
failed
outcomes: technique is not satisfied - All
passed
outcomes: technique needs further testing - An
inapplicable
outcome: technique needs further testing
- Any
Input Aspects
The following aspects are required in using this rule.
Test Cases
Passed
Passed Example 1
This <title>
element describes the content of the document.
<html lang="en">
<head>
<title>Clementine harvesting season</title>
</head>
<body>
<p>
Clementines will be ready to harvest from late October through February.
</p>
</body>
</html>
Passed Example 2
This <title>
element, the first of two, describes the content of the document.
<html lang="en">
<head>
<title>Clementine harvesting season</title>
<title>Second title is ignored</title>
</head>
<body>
<p>
Clementines will be ready to harvest from late October through February.
</p>
</body>
</html>
Passed Example 3
This <title>
element, which is within the body
, describes the content of the document. Even though it is not placed within the <head>
element, as expected according to the HTML specification, the rule still passes because the browser fixes it and it doesn’t cause any known accessibility issues.
<html lang="en">
<head> </head>
<body>
<title>Clementine harvesting season</title>
<p>
Clementines will be ready to harvest from late October through February.
</p>
</body>
</html>
Failed
Failed Example 1
This <title>
element does not describe the content of the document.
<html lang="en">
<head>
<title>Apple harvesting season</title>
</head>
<body>
<p>
Clementines will be ready to harvest from late October through February.
</p>
</body>
</html>
Failed Example 2
This <title>
element, the first of two, does not describe the content of the document. Most browsers, and this rule, only look at the first <title>
element.
<html lang="en">
<head>
<title>First title is incorrect</title>
<title>Clementine harvesting season</title>
</head>
<body>
<p>
Clementines will be ready to harvest from late October through February.
</p>
</body>
</html>
Inapplicable
Inapplicable Example 1
This title
element is a child of an svg
element.
<svg xmlns="http://www.w3.org/2000/svg">
<title>This is a circle</title>
<circle cx="150" cy="75" r="50" fill="green"></circle>
</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:
- Inapplicable: No part of the test subject matches the applicability
- Passed: A test target meets all expectations
- Failed: A test target does not meet all expectations
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.
Whitespace
Whitespace are characters that have the Unicode “White_Space” property in the Unicode properties list.
This includes:
- all characters in the Unicode Separator categories, and
-
the following characters in the Other, Control category:
- Character tabulation (U+0009)
- Line Feed (LF) (U+000A)
- Line Tabulation (U+000B)
- Form Feed (FF) (U+000C)
- Carriage Return (CR) (U+000D)
- Next Line (NEL) (U+0085)
Implementations
There are currently no known implementations for this rule. If you would like to contribute an implementation, please read the ACT Implementations page for details.
Changelog
This is the first version of this ACT rule.