Skip to content

Commit e5763fc

Browse files
mbgowerscottaoharaalastcfstrr
authored
Update label-in-name.html (#2725)
Adds examples and modifies wording to address two issues: Closes #2302 Closes #2276 --------- Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com> Co-authored-by: Alastair Campbell <ac@alastc.com> Co-authored-by: Francis Storr <francis.storr@intel.com>
1 parent 63d28b8 commit e5763fc

File tree

7 files changed

+212
-122
lines changed

7 files changed

+212
-122
lines changed

techniques/general/G211.html

+81-63
Large diffs are not rendered by default.
2.59 KB
Loading

understanding/21/label-in-name.html

+47-34
Original file line numberDiff line numberDiff line change
@@ -41,48 +41,61 @@ <h3>Identifying label text for components</h3>
4141
<section>
4242
<h3>Text labels "express something in human language"</h3>
4343
<section>
44-
<h4>Symbolic text characters</h4>
45-
<p>For the purposes of this SC, text should not be considered a visible label if it is used in a symbolic manner, rather than directly <q>expressing something in human language</q> as per the definition of <a>text</a> in WCAG. For example, <a href="images-of-text">1.4.5 Images of Text</a> describes considerations for "symbolic text characters." In the images of text example "B", "I", and "ABC" appear on icons in a text editor, where they are meant to symbolize the functions for Bold, Italics, and Spelling, respectively. In such a case, the accessible name should be the function the button serves (e.g., "Spell check" or "Check spelling"), not the visible symbolic characters. A similar text editor is shown in the figure below.</p>
46-
<figure id="figure-RTE-github">
47-
<img alt="Icons for transforming text, including heading, bold, italic, quote, code, and link, along with icons for ordered and unordered lists and other controls" src="img/rich-text-editor-detail.png" />
48-
<figcaption>A detail of the rich text editor in Github, showing a variety of unlabeled icons, including icons resembling text characters.</figcaption>
49-
</figure>
50-
<p>Likewise, where an author has used a greater-than symbol (<code>&gt;</code>) to mimic the appearance of the right-facing arrow, the text does not convey something in human language. It is a symbol, in this scenario likely meant to mimic the icons used for a "Play" button or a "Next" arrow.</p>
51-
</section>
52-
<section>
53-
<h4>Punctuation and capitalization</h4>
54-
<p>The use of punctuation and capitalization in labels <em>may</em> also be considered optional for the same reason. For example, the colon conventionally added at the end of input labels does not express something in human language, and capitals on the first letter of each word in a label do not normally alter the words' meaning. This is particularly relevant in the context of this SC, since it is primarily aimed at users of speech recognition; capitals and most punctuation are frequently ignored when a user speaks a label as a means of interacting with a control.</p>
55-
56-
<p>While it is certainly not an error to include the colon and capitalization in the accessible name, a computed name of "First name" should not be considered a failure of "First Name:".</p>
5744

58-
<pre xml:space="preserve"><code class="language-html">
59-
&lt;label for="firstname"&gt;First Name:&lt;/label&gt;
60-
&lt;input id="firstname" type="text" name="firstname"&gt;
61-
</code></pre>
62-
63-
<p>Likewise, "Next…" visibly shown on a button could have "Next" as the accessible name. When in doubt, where a meaningful visible label exists, match the string exactly for the accessible name.</p>
45+
<h4>Symbolic text characters</h4>
46+
<p>For the purposes of this SC, text should not be considered a visible label if it is used in a symbolic manner, rather than directly <q>expressing something in human language</q> as per the definition of <a>text</a> in WCAG. For example, <a href="https://www.w3.org/TR/WCAG21/#images-of-text">1.4.5 Images of Text</a> describes considerations for "symbolic text characters." In the images of text example "B", "I", and "ABC" appear on icons in a text editor, where they are meant to symbolize the functions for Bold, Italics, and Spelling, respectively. In such a case, the accessible name should be the function the button serves (e.g., "Spell check" or "Check spelling"), not the visible symbolic characters. A similar text editor is shown in the figure below.</p>
47+
<figure id="figure-RTE-github">
48+
<img alt="Icons for transforming text, including heading, bold, italic, quote, code, and link, along with icons for ordered and unordered lists and other controls" src="img/rich-text-editor-detail.png" />
49+
<figcaption>A detail of the rich text editor in Github, showing a variety of unlabeled icons, including icons resembling text characters.</figcaption>
50+
</figure>
51+
<p>Likewise, where an author has used a greater-than symbol (">") to mimic the appearance of the right-facing arrow, the text does not convey something in human language. It is a symbol, in this scenario likely meant to mimic the icons used for a "Play" button or a "Next" arrow.</p>
52+
</section>
53+
<h4>Punctuation and capitalization</h4>
54+
55+
<section>
56+
<p>The use of punctuation and capitalization in labels <em>may</em> also be considered optional for the same reason. For example, the colon conventionally added at the end of input labels does not express something in human language, and capitals on the first letter of each word in a label do not normally alter the words' meaning. This is particularly relevant in the context of this SC, since it is primarily aimed at users of speech recognition; capitals and most punctuation are frequently ignored when a user speaks a label as a means of interacting with a control.</p>
6457

65-
<pre xml:space="preserve"><code class="language-html">
66-
&lt;input type="submit" value="Next..."&gt;
67-
</code></pre>
58+
<p>While it is certainly not an error to include the colon and capitalization in the accessible name, a computed name of "First name" should not be considered a failure of "First Name:".<br />
59+
<label for="firstname">First Name: </label><input id="firstname" type="text" name="firstname" /><br />
60+
Likewise, "Next…" visibly shown on a button could have "Next" as the accessible name.<br />
61+
<input type="submit" value="Next..." />. When in doubt, where a meaningful visible label exists, match the string exactly for the accessible name.</p>
6862

6963
</section>
70-
<section>
71-
<h4>Mathematical expressions and formulae</h4>
72-
<p>Mathematical expressions are an exception to the previous subsection about symbolic characters. Math symbols can be used as labels; for example <code>11&#215;3=33</code> and <code>A&gt;B</code> convey meaning. The label should not be overwritten in the accessible name, and substitutions of words where a formula is used should be avoided since there are multiple ways to express the same equation. For example, making the name "eleven multiplied by three is equivalent to thirty-three" might mean a user who said "eleven times three equals thirty-three" may not match. It is best to leave the formulas as used in the label and count on the user's familiarity with their speech software to achieve a match. Further, converting a mathematical formula label into an accessible name that is a spelled-out equivalent may create issues for translation. The name should match the label's formula text. Note that a consideration for authors is to use the proper symbol in the formula. For instance <code>11x3</code> (with a lower or upper case letter X), <code>11*3</code> (with the asterisk symbol), and <code>11&#215;3</code> (with the <code>&amp;times;</code> symbol) are all easy for sighted users to interpret as meaning the same formula, but may not all be matched to "11 times 3" by the speech recognition software. The proper operator symbol (in this case the times symbol) should be used.</p>
64+
65+
<h4>Mathematical expressions and formulae</h4>
66+
<section>
67+
<p>Mathematical expressions are an exception to the previous subsection about symbolic characters. Math symbols can be used as labels; for example "11&#215;3=33" and "A>B" convey meaning.<br />
7368

74-
<pre xml:space="preserve"><code class="language-html">
75-
&lt;input type="radio" name="equation" id="answer1" value="A&gt;B"&gt;&lt;label for="answer1"&gt;A&gt;B&lt;/label&gt;
76-
&lt;input type="radio" name="equation" id="answer2" value="A=B"&gt;&lt;label for="answer2"&gt;A=B&lt;/label&gt;
77-
&lt;input type="radio" name="equation" id="answer3" value="A&lt;B"&gt;&lt;label for="answer3"&gt;A&lt;B&lt;/label&gt;
78-
</code></pre>
79-
69+
<input type="radio" name="equation" id="answer1" value="A&gt;B" /><label for="answer1">A&gt;B</label>
70+
<input type="radio" name="equation" id="answer2" value="11&times3=33" /><label for="answer2">11&times3=33</label>
71+
</p>
72+
<p>The label should not be overwritten in the accessible name, and substitutions of words where a formula is used should be avoided since there are multiple ways to express the same equation. For example, making the name "eleven multiplied by three is equivalent to thirty-three" might mean a user who said "eleven times three equals thirty-three" may not match. It is best to leave the formulas as used in the label and count on the user's familiarity with their speech software to achieve a match. Further, converting a mathematical formula label into an accessible name that is a spelled-out equivalent may create issues for translation. The name should match the label's formula text. Note that a consideration for authors is to use the proper symbol in the formula. For instance 11x3 (with a lower or upper case letter X), 11*3 (with the asterisk symbol), and 11&#215;3 (with the <code>&amp;</code>times<code>;</code> symbol) are all easy for sighted users to interpret as meaning the same formula, but may not all be matched to "11 times 3" by the speech recognition software. The proper operator symbol (in this case the times symbol) should be used.</p>
8073
</section>
8174
</section>
8275
<section>
83-
<h3>Accessible Name and Description Computation specification</h3>
84-
<p>It is important to understand how the accessible name is derived. The <a href="https://www.w3.org/TR/accname-1.1/">Accessible Name and Description Computation 1.1</a> and the <a href="https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation">HTML Accessibility API Mappings 1.0</a> describe how the accessible name is computed, including which attributes are considered in its calculation, and in what order of preference. If a component has multiple possible attribute values that could be used for its accessible name, only the most preferred of those values will be computed. None of the other, less preferred values will be part of the name. For the most part, existing established programmatic relationships between labels and controls are reinforced by the specification.</p>
85-
<p>Other text displayed on the screen that is correctly coded to meet 1.3.1: Info and Relationships is <strong>not</strong> normally factored into the calculation for the accessible name of a UI component without author intervention (via ARIA labeling techniques). The most common of these are:</p>
76+
77+
<h3>Accessible Name and Description Computation specification</h3>
78+
<p>It is important to understand how the accessible name is derived. The <a href="https://www.w3.org/TR/accname-1.1/">Accessible Name and Description Computation 1.1</a> and the <a href="https://w3c.github.io/html-aam/#accessible-name-and-description-computation">HTML Accessibility API Mappings 1.0</a> describe how the accessible name is computed, including which attributes are considered in its calculation, and in what order of preference. If a component has multiple possible attribute values that could be used for its accessible name, only the most preferred of those values will be computed. None of the other, less preferred values will be part of the name. For the most part, existing established programmatic relationships between labels and controls are reinforced by the specification.</p>
79+
<p>Other text displayed on the screen that is correctly coded to meet 1.3.1: Info and Relationships is <strong>not</strong> normally factored into the calculation for the accessible name of a UI component without author intervention (via ARIA labeling techniques). The most common of these are:</p>
80+
<ul>
81+
<li>headings and instructions</li>
82+
<li>group labels for sets of components (i.e., used with <code>legend</code>/<code>fieldset</code> or with role of <code>group</code> or <code>radiogroup</code>)</li>
83+
</ul>
84+
<p>Such textual information may constitute part of the component's <em>description</em>. So from both a programmatic viewpoint, and from the conservative tactic of only considering a label to be "adjacent text," neither headings, instructions, nor group 'labels' should normally be considered <strong>labels</strong> for the purpose of this Success Criterion.</p>
85+
<p>It is important to note that the specification allows authors to override the name calculated through native semantics. Both <code>aria-label</code> and <code>aria-labelledby</code> take precedence in the name calculation, overriding the visible text as the accessible name even when the visible text label is programmatically associated with the control. For this reason, when a visible label already exists, <code>aria-label</code> should be avoided or used carefully, and <code>aria-labelledby</code> should be used as a supplement with care.</p>
86+
<p>Finally, <code>aria-describedby</code> is not included in the Accessible Name computation (instead it is part of the Accessible Description computation). By convention, text associated with a control through <code>aria-describedby</code> is announced immediately after the accessible name by screen readers. Therefore, the context of headings, instructions, and group labels can be provided through the accessible description to assist users of screen readers without affecting the experience of those who navigate using speech recognition software.</p>
87+
</section>
88+
<h4>Text in parentheses</h4>
89+
<section>
90+
<p>Note: The term "parenthetical" in this section is describing text that literally appears within a set of round brackets (). It is not used in the more abstract sense of "information related to".</p>
91+
<p>It is important to mention parenthetical text in labels in the context of accessible name versus description. In common usage, text in parentheses is considered secondary but relevant to meaning. Users of speech recognition would not typically announce text in parentheses as part of the input name. For that reason, parenthetical text may be optionally considered a description and left out of the accessible name.</p>
92+
<p>However, where parenthetical information provides important context, such as indication of a required field or limitations on what is allowed for input, this information must be provided programmatically in some other way to the user if that information is not included as part of the accessible name. For example, "Name (required)" and "Date (YYYY-MM-DD)" could accept "Name" and "Date" as the accessible names. However, in order to pass 1.3.1 Info & Relationships, authors would need to programmatically surface both the required state and the limit on the allowed data formatting (in this example, eight integers fitting the YYYY-MM-DD pattern). The "required" state could be surfaced through the HTML <code>required</code> attribute or by using <code>aria-required="true"</code>. The allowed data formatting could be surfaced by being referenced using the <code>aria-describedby</code>) attribute.</p>
93+
</section>
94+
95+
96+
<section id="benefits">
97+
<h2>Benefits</h2>
98+
8699
<ul>
87100
<li>headings and instructions</li>
88101
<li>group labels for sets of components (i.e., used with <code>legend</code>/<code>fieldset</code> or with role of <code>group</code> or <code>radiogroup</code>)</li>

working-examples/label-in-name-general/example1.html

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2-
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
1+
<!DOCTYPE html>
2+
<html lang="en">
33
<head>
4+
45
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6+
57
<title>Example of Simple Radio Button Group</title>
8+
<style>
9+
html{
10+
background: white;
11+
color:black;
12+
}
13+
body{
14+
font: 1rem/1.5 system-ui, "Segoe UI", Roboto, Helvetica, sans-serif;
15+
}
16+
</style>
617
</head>
718
<body>
819
<fieldset>
20+
921
<legend>Call me when balance exceeds $10,000?</legend><br/>
22+
1023
<input type="radio" id="yes" name="callme" value="yes">
1124
<label for="yes">Yes</label>
1225
<input type="radio" id="no" name="callme" value="no">
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
1-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2-
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
1+
<!DOCTYPE html>
2+
<html lang="en">
33
<head>
4+
45
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5-
<title>Example of Stacked Labels</title>
6-
<style type="text/css">
7-
form
8-
{font-family:Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;}
9-
.example-page
10-
{padding:60px 30px 30px}
11-
.form-group
12-
{margin-bottom:20px}
13-
.label
14-
{font-size:1.2rem;line-height:1.3;color:#0b0c0c;display:block;margin-bottom:5px}
15-
.hint
16-
{font-size:1rem;line-height:1.25;display:block;margin-bottom:5px;color:#6f777b}
17-
.input
18-
{font-size: 1rem;line-height: 1.25;box-sizing: border-box;width: 70%;height: 40px;padding:5px;border: 2px solid #0b0c0c; border-radius: 0;}
196

7+
<title>Example of Stacked Labels</title>
8+
<style>
9+
html{
10+
background: white;
11+
color:black;
12+
}
13+
body{
14+
font: 1rem/1.5 system-ui, "Segoe UI", Roboto, Helvetica, sans-serif;
15+
}
16+
input{
17+
border: 2px solid #0b0c0c;
18+
border-radius: 0;
19+
font:inherit;
20+
letter-spacing: inherit;
21+
padding:0.4em;
22+
width: 70%;
23+
word-spacing: inherit;
24+
}
25+
.form-group {
26+
margin-bottom:1.125rem
27+
}
28+
.label {
29+
color:#0b0c0c;
30+
display:block;
31+
font-size:1.2rem;
32+
line-height:1.3;
33+
margin-bottom:5px}
34+
.hint{
35+
color:#6f777b;
36+
display:block;
37+
font-size:1rem;
38+
line-height:1.25;
39+
margin-bottom:0.26em;
40+
}
2041
</style>
2142

2243
</head>
@@ -40,9 +61,6 @@
4061
</span>
4162
<input class="input" id="example-2" name="example-2" type="text" aria-describedby="example-2-hint">
4263
</div>
43-
44-
45-
4664
</form>
4765
</body>
4866
</html>

working-examples/label-in-name-general/example3.html

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2-
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
1+
<!DOCTYPE html>
2+
<html lang="en">
33
<head>
4+
45
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6+
57
<title>Example of Work Phone input set</title>
8+
<style>
9+
html{
10+
background: white;
11+
color:black;
12+
}
13+
body{
14+
font: 1rem/1.5 system-ui, "Segoe UI", Roboto, Helvetica, sans-serif;
15+
}
16+
input{
17+
border: 1px solid #0b0c0c;
18+
font:inherit;
19+
letter-spacing: inherit;
20+
word-spacing: inherit;
21+
}
22+
</style>
623
</head>
724
<body>
825
<div role="group" aria-labelledby="groupLabel">

working-examples/label-in-name-general/example4.html

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2-
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
1+
<!DOCTYPE html>
2+
<html lang="en">
33
<head>
4+
45
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6+
57
<title>Example of Range of Inputs</title>
8+
<style>
9+
html{
10+
background: white;
11+
color:black;
12+
}
13+
body{
14+
font: 1rem/1.5 system-ui, "Segoe UI", Roboto, Helvetica, sans-serif;
15+
}
16+
</style>
617
</head>
718
<body>
819
<fieldset>

0 commit comments

Comments
 (0)