Skip to content

Commit 7410c4d

Browse files
committed
Merge remote-tracking branch 'origin/apg-1.2' into 2021-11_Note
2 parents 8e0c5b6 + f9441af commit 7410c4d

35 files changed

+2254
-1791
lines changed

aria-practices.html

Lines changed: 129 additions & 24 deletions
Large diffs are not rendered by default.

examples/checkbox/checkbox-mixed.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h1>Checkbox Example (Mixed-State)</h1>
3434
</p>
3535
<p>Similar examples include: </p>
3636
<ul>
37-
<li><a href="../checkbox-1/checkbox-1.html">Checkbox (Two State)</a>: Simple two state checkbox.</li>
37+
<li><a href="checkbox.html">Checkbox (Two State)</a>: Simple two state checkbox.</li>
3838
</ul>
3939
<section>
4040
<div class="example-header">

examples/checkbox/checkbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h1>Checkbox Example (Two State)</h1>
2929

3030
<p>Similar examples include: </p>
3131
<ul>
32-
<li><a href="../checkbox-2/checkbox-2.html">Checkbox (Mixed-State)</a>: Mixed state checkbox controlling standard input checkboxes.</li>
32+
<li><a href="checkbox-mixed.html">Checkbox (Mixed-State)</a>: Demonstrates a checkbox that uses the mixed value for aria-checked to reflect and control checked states within a group of two-state HTML checkboxes contained in an HTML <code>fieldset</code>.</li>
3333
</ul>
3434

3535
<section>

examples/combobox/combobox-autocomplete-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ <h3 id="kbd_label_textbox">Textbox</h3>
203203
</tr>
204204
<tr data-test-id="textbox-key-enter">
205205
<th><kbd>Enter</kbd></th>
206-
<td>Closes the listbox.</td>
206+
<td>Closes the listbox if it is displayed.</td>
207207
</tr>
208208
<tr data-test-id="textbox-key-escape">
209209
<th><kbd>Escape</kbd></th>

examples/combobox/combobox-autocomplete-none.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,7 @@ <h3 id="kbd_label_textbox">Textbox</h3>
156156
</tr>
157157
<tr data-test-id="textbox-key-enter">
158158
<th><kbd>Enter</kbd></th>
159-
<td>
160-
<ul>
161-
<li>Sets the textbox value to the content of the selected option.</li>
162-
<li>Closes the listbox if it is displayed.</li>
163-
</ul>
164-
</td>
159+
<td>Closes the listbox if it is displayed.</td>
165160
</tr>
166161
<tr data-test-id="standard-single-line-editing-keys">
167162
<th>Standard single line text editing keys</th>

examples/combobox/grid-combo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ <h3 id="rps_label_popup">Grid Popup</h3>
370370
<td><code>div</code></td>
371371
<td>
372372
<ul>
373-
<li>Specified on a row in the grid when it is visually indicated as selected.</li>
373+
<li>Specified on a cell when the row containing the cell is visually indicated as selected.</li>
374374
<li>Occurs only when a cell in the grid is referenced by <code>aria-activedescendant</code>.</li>
375375
</ul>
376376
</td>

examples/dialog-modal/alertdialog.html

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ <h1>Alert Dialog Example</h1>
3535
<p>To use this example:</p>
3636
<ul>
3737
<li>
38-
Activate the "discard" button to trigger a confirmation dialog.
38+
Activate the "discard" button to trigger a confirmation dialog that has the <code>alertdialog</code> role.
3939
<ul>
40-
<li>Activating the "yes" button removes the contents of both the "Notes" text area and local storage of the notes.</li>
40+
<li>Activating the "yes" button in the confirmation dialog removes the contents of both the "Notes" text area and local storage of the notes.</li>
4141
<li>Activating the "no" button or pressing <kbd>escape</kbd> closes the dialog.</li>
4242
<li>The "discard" button is disabled if the notes text area does not contain any text.</li>
4343
</ul>
4444
</li>
45-
<li>
46-
Activate the "save" button to trigger an alert when it saves the contents of the "Notes" text area to <a href="https://www.w3.org/TR/webstorage/#the-localstorage-attribute">local storage</a>.
45+
<li>Activate the "save" button to trigger an alert when the contents of the "Notes" text area is saved to <a href="https://www.w3.org/TR/webstorage/#the-localstorage-attribute">local storage</a>.
4746
<ul>
4847
<li>A successful save triggers a short alert to notify the user that the notes have been saved.</li>
4948
<li>The "save" button is disabled if the user's local storage value is the same as the "Notes" field.</li>
@@ -68,9 +67,17 @@ <h2 id="ex_label">Example</h2>
6867
<div id="ex_alertdialog">
6968
<label for="notes">Notes</label>
7069
<textarea class="notes" name="notes" id="notes" rows="7">This is an example text box, which unsurprisingly contains text. The user is given the option to save this text - which triggers a basic alert - or to discard the text - which triggers an alert dialog that prompts the user for confirmation.</textarea>
71-
<button type="button" aria-controls="notes" id="notes_save">Save</button>
72-
<button type="button" aria-controls="notes" id="notes_discard" onclick="openAlertDialog('alert_dialog', this)">Discard</button>
73-
<div role="alert" id="alert_toast" class="toast hidden">Nothing to discard.</div>
70+
<div class="visually-hidden" id="notes_save_status" role="alert"></div>
71+
<button type="button" id="notes_save">
72+
Save
73+
<svg class="icon spinner" viewBox="0 0 32 32" aria-hidden="true">
74+
<path d="M16 32c-4.274 0-8.292-1.664-11.314-4.686s-4.686-7.040-4.686-11.314c0-3.026 0.849-5.973 2.456-8.522 1.563-2.478 3.771-4.48 6.386-5.791l1.344 2.682c-2.126 1.065-3.922 2.693-5.192 4.708-1.305 2.069-1.994 4.462-1.994 6.922 0 7.168 5.832 13 13 13s13-5.832 13-13c0-2.459-0.69-4.853-1.994-6.922-1.271-2.015-3.066-3.643-5.192-4.708l1.344-2.682c2.615 1.31 4.824 3.313 6.386 5.791 1.607 2.549 2.456 5.495 2.456 8.522 0 4.274-1.664 8.292-4.686 11.314s-7.040 4.686-11.314 4.686z"></path>
75+
</svg>
76+
<svg class="icon check" viewBox="0 0 32 32" aria-hidden="true">
77+
<path d="M27 4l-15 15-7-7-5 5 12 12 20-20z"></path>
78+
</svg>
79+
</button>
80+
<button type="button" data-textbox="notes" id="notes_discard" onclick="openAlertDialog('alert_dialog', this)">Discard</button>
7481
<div class="dialog-backdrop no-scroll">
7582
<div id="alert_dialog" role="alertdialog" aria-modal="true" aria-labelledby="dialog_label" aria-describedby="dialog_desc" class="hidden">
7683
<h2 id="dialog_label" class="dialog_label">Confirmation</h2>
@@ -79,7 +86,7 @@ <h2 id="dialog_label" class="dialog_label">Confirmation</h2>
7986
</div>
8087
<div class="dialog_form_actions">
8188
<button type="button" onclick="closeDialog(this)">No</button>
82-
<button type="button" aria-controls="notes" id="notes_confirm" onclick="discardInput(this)">Yes</button>
89+
<button type="button" id="notes_confirm" onclick="discardInput(this)">Yes</button>
8390
</div>
8491
</div>
8592
</div>
@@ -88,14 +95,18 @@ <h2 id="dialog_label" class="dialog_label">Confirmation</h2>
8895
</section>
8996
<section>
9097
<h2>Accessibility Features</h2>
91-
<ol>
92-
<li>The accessible label for the alert dialog is set to its heading ("Confirmation").</li>
98+
<ul>
99+
<li>The accessible name of the alert dialog is set to its heading ("Confirmation").</li>
93100
<li>The dialog's prompt ("Are you sure...?") is referenced via <code>aria-describedby</code> to ensure that the user is immediately aware of the prompt.</li>
94101
<li>
95102
Focus is automatically set to the first focusable element inside the dialog, which is the "No" <code>button</code>.
96103
This is the least destructive action, so focusing "No" helps prevent users from accidentally confirming the destructive "Discard" action, which cannot be undone.
97104
</li>
98-
</ol>
105+
<li>
106+
When the buttons are disabled, <code>aria-disabled</code> is used instead of the HTML <code>disabled</code> attribute so the buttons will remain in the page <kbd>Tab</kbd> sequence.
107+
This makes it easier for screen reader users to discover the buttons and discern how the interface works.
108+
</li>
109+
</ul>
99110
</section>
100111
<section>
101112
<h2 id="kbd_label">Keyboard Support</h2>
@@ -162,23 +173,23 @@ <h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
162173
</tr>
163174
<tr>
164175
<td></td>
165-
<th scope="row"><code>aria-labelledby=<q>IDREF</q></code></th>
176+
<th scope="row"><code>aria-labelledby="ID_REFERENCE"</code></th>
166177
<td><code>div</code></td>
167178
<td>
168179
Gives the alert dialog an accessible name by referring to the element that provides the alert dialog title.
169180
</td>
170181
</tr>
171182
<tr>
172183
<td></td>
173-
<th scope="row"><code>aria-describedby=<q>IDREF</q></code></th>
184+
<th scope="row"><code>aria-describedby="ID_REFERENCE"</code></th>
174185
<td><code>div</code></td>
175186
<td>
176187
Gives the alert dialog an accessible description by referring to the alert dialog content that describes the primary message or purpose of the alert dialog.
177188
</td>
178189
</tr>
179190
<tr>
180191
<td></td>
181-
<th scope="row"><code>aria-modal=<q>true</q></code></th>
192+
<th scope="row"><code>aria-modal="true"</code></th>
182193
<td><code>div</code></td>
183194
<td>
184195
Tells assistive technologies that the windows underneath the current alert dialog are not available for interaction (inert).
@@ -192,26 +203,31 @@ <h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
192203
Identifies the element that serves as the alert notification.
193204
</td>
194205
</tr>
206+
<tr>
207+
<td></td>
208+
<th scope="row"><code>aria-disabled="true"</code></th>
209+
<td><code>button</code></td>
210+
<td>Tells assistive technology users the button cannot be activated.</td>
211+
</tr>
195212
</tbody>
196213
</table>
197214
<h3>Notes on <code>aria-modal</code> and <code>aria-hidden</code></h3>
198-
<ol>
215+
<ul>
199216
<li>
200217
The <code>aria-modal</code> property was introduced in ARIA 1.1.
201-
As a new property, screen reader users may experience varying degrees of support for it.
218+
As a relatively new property, screen reader users may experience varying degrees of support for it.
202219
</li>
203220
<li>
204-
Applying the <code>aria-modal</code> property to the <code>dialog</code> element
205-
replaces the technique of using <code>aria-hidden</code> on the background for informing assistive technologies that content outside a dialog is inert.
221+
Applying the <code>aria-modal</code> property to the <code>dialog</code> element replaces the technique of using <code>aria-hidden</code> on the background for informing assistive technologies that content outside a dialog is inert.
206222
</li>
207223
<li>
208224
In legacy dialog implementations where <code>aria-hidden</code> is used to make content outside a dialog inert for assistive technology users, it is important that:
209-
<ol>
225+
<ul>
210226
<li><code>aria-hidden</code> is set to <code>true</code> on each element containing a portion of the inert layer.</li>
211227
<li>The dialog element is not a descendant of any element that has <code>aria-hidden</code> set to <code>true</code>.</li>
212-
</ol>
228+
</ul>
213229
</li>
214-
</ol>
230+
</ul>
215231
</section>
216232
<section>
217233
<h2 id="src_label">Javascript and CSS Source Code</h2>

examples/dialog-modal/css/dialog.css

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,48 @@
146146
width: 33%;
147147
}
148148

149-
.toast {
150-
background-color: rgb(0 0 0 / 90%);
151-
color: #fff;
152-
padding: 1rem;
153-
border: none;
154-
border-radius: 0.25rem;
155-
box-shadow: 0 3px 6px rgb(0 0 0 / 16%), 0 3px 6px rgb(0 0 0 / 23%);
156-
position: fixed;
157-
top: 1rem;
158-
right: 1rem;
159-
transform: translateY(-150%);
160-
transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1);
149+
.visually-hidden {
150+
border: 0;
151+
clip: rect(0 0 0 0);
152+
height: auto;
153+
margin: 0;
154+
overflow: hidden;
155+
padding: 0;
156+
position: absolute;
157+
width: 1px;
158+
white-space: nowrap;
159+
}
160+
161+
#notes_save {
162+
display: inline-flex;
163+
align-items: center;
164+
gap: 0.5rem;
161165
}
162166

163-
.toast.active {
164-
transform: translateY(0);
167+
#notes_save svg {
168+
display: block;
169+
width: 0.75rem;
170+
}
171+
172+
#notes_save .icon {
173+
display: none;
174+
}
175+
176+
@keyframes rotate {
177+
0% {
178+
transform: rotate(0deg);
179+
}
180+
181+
100% {
182+
transform: rotate(360deg);
183+
}
184+
}
185+
186+
#notes_save.loading .spinner {
187+
display: block;
188+
animation: rotate 2s linear infinite;
189+
}
190+
191+
#notes_save.saved .check {
192+
display: block;
165193
}

0 commit comments

Comments
 (0)