Skip to content

Examples of Common and Default Language of an Element

These are examples of the definitions for most common language of an element and default language of a page. The examples presented here are non-normative and not testable. They serve to illustrate some common pitfalls about the definition and to help implementers of ACT rules understand it.

One Language

This p element has a most common language of English because all words in it are English words.

<p>
	The Accessibility Conformance Testing (ACT) Rules Format 1.0 defines a format for writing accessibility test rules.
</p>

Two Languages

This p element has a most common language of English because only one word is not English.

<p>The Dutch word "gelukkig" has no equivalent in English.</p>

Ignored Ancestors

This span element has a most common language of Dutch because the text in the parent p element is not part of the text inheriting its programmatic language from it.

<p>The Dutch word "<span>gelukkig</span>" has no equivalent in English.</p>

Ignored Descendants

This div element has a most common language of Dutch because the second p element is not one of the elements inheriting their programmatic language from it due to its own lang attribute. Hence the English words are ignored when looking for the language of the div element.

<div>
	<p>"Hij ging met de kippen op stok"</p>
	<p lang="en">
		This Dutch phrase literally translates into "He went to roost with the chickens", but it means that he went to bed
		early.
	</p>
</div>

Title

This html element has a most common language of English. Since it is a document element, its title attribute is taken into account. Therefore, this page also has a default language of English.

<html title="I love ACT rules"></html>

Referenced Elements

This div element has a most common language of English. The only element inheriting its programmatic language from it is the img (because the p element has a lang attribute of its own), but the full accessible name of it is taken into account. Assistive Technologies usually ignore lang attributes on elements that are used to compute accessible names.

<div>
	<img src="/test-assets/shared/fireworks.jpg" aria-labelledby="caption" />
	<p lang="en" id="caption" hidden>
		Fireworks over Paris!
	</p>
</div>

No Words

This div element has no most common language because it has no words in it. The only element inheriting its programmatic language from it is the img which has no text node children and no accessible name.

<div>
	<img src="/test-assets/shared/fireworks.jpg" alt="" />
	<p lang="en">
		I have seen fireworks over Paris!
	</p>
</div>

Ambiguous Words

This p element has two most common languages because its words (and the sentence) are both English and French. Therefore, this page has no default language since there is no unique most common language.

<html>
	<p>Paul put dire comment on tape</p>
</html>

Nested Browsing Contexts

This div element has a most common language of English. The content of the iframe element is taken into account because the iframe will be rendered as if it’s part of the same page. Note that iframe are intended to provide a layer of isolation (for privacy and security reasons), so it is not clear whether the outer lang attribute is inherited inside it or not. It is clear, however, that the span element will not inherit it and therefore it is not considered when figuring out the most common language of the div element.

<div lang="en">
	<iframe srcdoc="
	<p>This is an English paragraph. <span lang="fr">Il contient une phrase française.</span></p>
	"
</div>

Glossary

Accessible name

The accessible name is the programmatically determined name of a user interface element that is included in the accessibility tree.

The accessible name is calculated using the accessible name and description computation.

For native markup languages, such as HTML and SVG, additional information on how to calculate the accessible name can be found in HTML Accessibility API Mappings 1.0, Accessible Name and Description Computation (working draft) and SVG Accessibility API Mappings, Name and Description (working draft).

For more details, see examples of accessible name.

Note: As per the accessible name and description computation, each element always has an accessible name. When no accessible name is provided, the element will nonetheless be assigned an empty ("") one.

Note: As per the accessible name and description computation, accessible names are flat string trimmed of leading and trailing whitespace. Notably, it is not possible for a non-empty accessible name to be composed only of whitespace since these must be trimmed.

Attribute value

The attribute value of a content attribute set on an HTML element is the value that the attribute gets after being parsed and computed according to specifications. It may differ from the value that is actually written in the HTML code due to trimming whitespace or non-digits characters, default values, or case-insensitivity.

Some notable case of attribute value, among others:

This list is not exhaustive, and only serves as an illustration for some of the most common cases.

The attribute value of an IDL attribute is the value returned on getting it. Note that when an IDL attribute reflects a content attribute, they have the same attribute value.

Focusable

An element is focusable if one or both of the following are true:

Exception: Elements that lose focus and do not regain focus during a period of up to 1 second after gaining focus, without the user interacting with the page the element is on, are not considered focusable.

Notes:

Included in the accessibility tree

Elements included in the accessibility tree of platform specific accessibility APIs are exposed to assistive technologies. This allows users of assistive technology to access the elements in a way that meets the requirements of the individual user.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. For native markup languages, such as HTML and SVG, additional rules for when elements are included in the accessibility tree can be found in the HTML accessibility API mappings (working draft) and the SVG accessibility API mappings (working draft).

For more details, see examples of included in the accessibility tree.

Programmatically hidden elements are removed from the accessibility tree. However, some browsers will leave focusable elements with an aria-hidden attribute set to true in the accessibility tree. Because they are hidden, these elements are considered not included in the accessibility tree. This may cause confusion for users of assistive technologies because they may still be able to interact with these focusable elements using sequential keyboard navigation, even though the element should not be included in the accessibility tree.

Known Primary Language Tag

A language tag has a known primary language tag if its primary language subtag exists in the language subtag registry with a Type field whose field-body value is language.

A “language tag” is here to be understood as in the first paragraph of the RFC 5646 language tag syntax, i.e. a sequence of subtags separated by hyphens, where a subtag is any sequence of alphanumerical characters. Language tag that are not valid according to the stricter RFC 5646 syntax (and ABNF grammar) definition can still have a known primary language tag. User agents and assistive technologies are more lenient in what they accept. This definition is consistent with the behavior of the :lang() pseudo-selector as defined by Selectors Level 3.

As an example, de-hello would be an accepted way to indicate German in current user agents and assistive technologies, despite not being valid according to RFC 5646 grammar. It has a known primary language tag (namely, de).

As a consequence of this definition, however, grandfathered tags do not have a known primary language tag.

Subtags, notably the primary language subtag, are case insensitive. Comparison with the language subtag registry must be done in a case insensitive way.

Most Common Language of an Element

The most common language of an element is determined by counting the number of words in the text inheriting its programmatic language from this element that are part of any of the languages in the language subtag registry. The same word can be part of multiple languages. In case of ties, the element has several most common languages. If there are no words in the text inheriting its programmatic language from the element, then it has no most common language.

For more details, see examples of most common language.

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

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 five following types:

Note: A rule has one passed or failed outcome for every test target. When a tester evaluates a test target it can also be reported as cantTell if the rule cannot be tested in its entirety. For example, when applicability was automated, but the expectations have to be evaluated manually.

When there are no test targets the rule has one inapplicable outcome. If the tester is unable to determine whether there are test targets there will be one cantTell outcome. And when no evaluation has occurred the test target has one untested outcome. This means that each test subject always has one or more outcomes.

Outcomes used in ACT Rules can be expressed using the outcome property of the EARL10-Schema.

Programmatically Hidden

An HTML element is programmatically hidden if either it has a computed CSS property visibility whose value is not visible; or at least one of the following is true for any of its inclusive ancestors in the flat tree:

Note: Contrary to the other conditions, the visibility CSS property may be reverted by descendants.

Note: The HTML standard suggests setting the CSS display property to none for elements with the hidden attribute. While not required by HTML, all modern browsers follow this suggestion. Because of this the hidden attribute is not used in this definition. In browsers that use this suggestion, overriding the CSS display property can reveal elements with the hidden attribute.

Text Inheriting its Programmatic Language from an Element

The text inheriting its programmatic language from an element E is composed of all the following texts:

An element F is an element inheriting its programmatic language from an element E if at least one of the following conditions is true (recursively):

Visible

Content perceivable through sight.

Content is considered visible if making it fully transparent would result in a difference in the pixels rendered for any part of the document that is currently within the viewport or can be brought into the viewport via scrolling.

Content is defined in WCAG.

For more details, see examples of visible.

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/.