Skip to content

Commit 9a96ee9

Browse files
authored
[ARIA Notify] Rename notificationId (#831)
* Rename notificationId and nitpicks * More nitpicks
1 parent 03fc07a commit 9a96ee9

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

Accessibility/AriaNotify/explainer.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# ariaNotify
1+
# ARIA Notify
22

33
Authors: [Doug Geoffray](), [Alison Maher](), [Sara Tang](https://github.com/sartang), [Travis Leithead](https://github.com/travisleithead), [Daniel Libby](https://github.com/dlibby-)
44

5-
## Introduction
6-
### Abstract
5+
## Introduction
76

7+
### Abstract
88
For people who are blind or have low vision, identifying dynamic changes (non-user-initiated) in the content of a web
99
app is very challenging. ARIA live regions are the only mechanism available today that communicate content changes down
1010
to the accessibility layer so that users can hear about them. ARIA live regions are inconsistently implemented, have
@@ -162,19 +162,19 @@ as the concept of [earcons](https://en.wikipedia.org/wiki/Earcon)). Without addi
162162
options can be offered: options that apply to all `ariaNotify` notifications universally or customization on a
163163
per-notification-string basis.
164164

165-
To aid in customization, `ariaNotify` provides a method to give context of the notification (`notificationID`). This
165+
To aid in customization, `ariaNotify` provides a method to give context of the notification (`notificationId`). This
166166
explainer provides a set of potential suggestions but allows for arbitrary non-localized strings to be used by the
167167
content author. All strings will be processed by the user agent according to a fixed algorithm ([ASCII
168168
encode](https://infra.spec.whatwg.org/#ascii-encode), then [ASCII
169169
lowercase](https://infra.spec.whatwg.org/#ascii-lowercase), and finally, [strip leading and trailing ASCII
170170
whitespace](https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace)) before the notification is sent
171171
to the platform API (invalid strings will throw an exception).
172172

173-
When no `notificationID` is explicitly provided by the content author, the `notificationID` is set to `notify` by
173+
When no `notificationId` is explicitly provided by the content author, the `notificationId` is set to `notify` by
174174
default.
175175

176-
To specify a `notificationID`, pass the string as the second parameter. Alternatively, the `notificationID` may be
177-
expressed in an object form with property `notificationID`. For example:
176+
To specify a `notificationId`, pass the string as the second parameter. Alternatively, the `notificationId` may be
177+
expressed in an object form with property `notificationId`. For example:
178178

179179
#### Example 2
180180
```
@@ -185,11 +185,11 @@ document.ariaNotify(
185185
// ...
186186
myfile.asyncFileUpload().then( () => {
187187
document.ariaNotify( "File untitled-1 uploaded.", {
188-
notificationID: "task-progress-finished" } );
188+
notificationId: "task-progress-finished" } );
189189
});
190190
```
191191

192-
Screen readers may allow their users to filter out these task-progress `notificationID`, may make these notifications
192+
Screen readers may allow their users to filter out these task-progress `notificationId`, may make these notifications
193193
only available at particular verbosity levels, or may replace the output strings with audio cues.
194194

195195
### Managing pending notifications
@@ -206,7 +206,7 @@ notifications). This is determined using the `priority` and `interrupt` properti
206206
More specifically, the `priority` property can be used to ensure the notification is placed ahead of lesser priority
207207
notifications.
208208

209-
`Priority` indicates where the screen reader should add the notification in relationship to any existing pending
209+
`priority` indicates where the screen reader should add the notification in relationship to any existing pending
210210
notifications:
211211
- `important`
212212
- Screen reader should add this string to the end of any other pending important notifications but before all
@@ -217,14 +217,14 @@ notifications:
217217
#### Example 3
218218
```
219219
// Dispatch a notification updating background task status -- low priority
220-
Document.ariaNotify( "Background task completed",
220+
document.ariaNotify( "Background task completed",
221221
{ "priority":"none",
222-
"notificationID":"StatusUpdate" });
222+
"notificationId":"StatusUpdate" });
223223
224224
// Dispatch a high priority notification that data may be lost
225-
Document.ariaNotify("Unable to save changes, lost connection to server",
225+
document.ariaNotify("Unable to save changes, lost connection to server",
226226
{ "priority":"important",
227-
"notificationID":"ServerError" });
227+
"notificationId":"ServerError" });
228228
```
229229

230230
Assuming the initial low priority string hasn't already started to be acted upon (spoken/brailled), the high priority
@@ -237,21 +237,21 @@ the user first.
237237
// User has initiated an action which starts a generation process of data.
238238
// During the status of the generation, a more critical status needs to be
239239
// sent to the user
240-
Document.querySelector("#dataStatus")
240+
document.querySelector("#dataStatus")
241241
.ariaNotify( "generating content",
242-
{ "notificationID":"statusUpdate" });
242+
{ "notificationId":"statusUpdate" });
243243
244-
Document.querySelector("#dataStatus")
244+
document.querySelector("#dataStatus")
245245
.ariaNotify( "processing data ",
246-
{ "notificationID":"statusUpdate" });
246+
{ "notificationId":"statusUpdate" });
247247
248-
Document.querySelector("#dataStatus")
248+
document.querySelector("#dataStatus")
249249
.ariaNotify( "counting items ",
250-
{ "notificationID":"statusUpdate" } );
250+
{ "notificationId":"statusUpdate" } );
251251
252-
Document.ariaNotify( " server connection lost ",
252+
document.ariaNotify( " server connection lost ",
253253
{ "priority":"important",
254-
"notificationID":"serverStatus" } );
254+
"notificationId":"serverStatus" } );
255255
```
256256

257257
As content is being generated, the user is informed of that status. When something more serious occurs, such as losing
@@ -290,12 +290,12 @@ scenario (a progress bar which reports its status at every percent increment):
290290
let percent = 0;
291291
function simulateProgress() {
292292
percent += 1;
293-
UpdateProgressBarVisual(percent);
293+
updateProgressBarVisual(percent);
294294
// Report progress to ariaNotify. interrupt:none will cause each percent
295295
// update to be fully spoken
296296
document.querySelector("#progressBar")
297297
.ariaNotify( "Progress is ${currentValue}",
298-
{ "notificationID": "progressBar",
298+
{ "notificationId": "progressBar",
299299
"priority":"none",
300300
"interrupt":"none" });
301301
}
@@ -317,13 +317,13 @@ first part of each/some percentage until the last is processed where the user wi
317317
let percent = 0;
318318
function simulateProgress() {
319319
percent += 1;
320-
UpdateProgressBarVisual(percent);
320+
updateProgressBarVisual(percent);
321321
// Report progress to ariaNotify. interrupt all will cause each percentage
322322
// update to interrupt any existing percentage that may be speaking, flush any
323323
// pending percentages, and add the latest
324324
document.querySelector("#progressBar")
325325
.ariaNotify( "Progress is ${currentValue}",
326-
{ "notificationID":"progressBar",
326+
{ "notificationId":"progressBar",
327327
"priority":"none",
328328
"interrupt":"all" });
329329
}
@@ -348,13 +348,13 @@ speak, and the process will repeat. Finally, the last percentage "Progress is 10
348348
let percent = 0;
349349
function simulateProgress() {
350350
percent += 1;
351-
UpdateProgressBarVisual(percent);
351+
updateProgressBarVisual(percent);
352352
// Report progress to ariaNotify. interrupt pending will allow the current
353353
// percentage to finish speaking, flush any pending percentages, and add the
354354
// latest
355355
document.querySelector("#progressBar")
356356
.ariaNotify( "Progress is ${currentValue}",
357-
{ "notificationID":"progressBar",
357+
{ "notificationId":"progressBar",
358358
"priority":"none",
359359
"interrupt":"pending" });
360360
}
@@ -387,7 +387,7 @@ directly to ARIA live regions.
387387
In the case of browsers that do not yet support `ariaNotify`, we propose the following fallback mechanism using the same
388388
backend as the existing ARIA live regions:
389389
- The message payload for `ariaNotify` is equivalent to the contents of an ARIA live region.
390-
- The `notificationID` is dropped entirely.
390+
- The `notificationId` is dropped entirely.
391391
- `"priority: important"` and `"priority: none"` correspond to `aria-live="assertive"` and `aria-live="polite"` ARIA
392392
live attributes, respectively.
393393
- ARIA live regions do not support interruptibility, so all behavior of `interrupt` defaults to `none`.
@@ -420,13 +420,13 @@ if ("ariaNotify" in element) {
420420
```
421421

422422
## Open Issues
423-
### Predefined notificationIDs
424-
The use of `notificationIDs` give the screen reader contextual information regarding the notification which allows for
423+
### Predefined notificationIds
424+
The use of `notificationId` give the screen reader contextual information regarding the notification which allows for
425425
creative approaches to dispatching the information to their users. The question then arises of whether the API should
426-
create a predetermined set of `notificationID` names for common/expected scenarios or whether having predefined names is
426+
create a predetermined set of `notificationId` names for common/expected scenarios or whether having predefined names is
427427
pointless given no matter the list, it will always fall short.
428428

429-
Possible examples of predefined notificationIDs could be something like:
429+
Possible examples of predefined `notificationId` could be something like:
430430
- Recent action completion status: `action-completion-success`, `action-completion-warning`,
431431
`action-completion-failure`
432432
- Async/indeterminate task progress: `task-progress-started`, `task-progress-ongoing`, `task-progress-blocked`,
@@ -492,9 +492,9 @@ See Security and Privacy section for additional details.
492492

493493
**Are Element-level notifications really necessary?**
494494

495-
Adding ariaNotify to Elements was driven by several goals:
495+
Adding `ariaNotify` to Elements was driven by several goals:
496496
- Resolve the question of how language input should be provided. To keep the API simple, we are able to leverage the
497-
lang attribute that is used to override the document language for specific subtrees. ariaNotify can use the nearest
497+
lang attribute that is used to override the document language for specific subtrees. `ariaNotify` can use the nearest
498498
ancestor element's lang attribute as a language hint (or the document's default language).
499499
- Screen readers can filter/prioritize notifications based on the element associated with the notification queue. E.g.,
500500
the element's current visibility in the User Agent, the element's proximity to the focused element. (Same potential
@@ -504,15 +504,15 @@ Adding ariaNotify to Elements was driven by several goals:
504504

505505
Screen reader users can customize the verbosity of the information (and context) that is read to them via settings.
506506
Screen reader vendors can also adapt the screen reader on a per site or per app basis for the best experience of their
507-
users. ariaNotify offers notificationID as a mechanism to allow screen reader vendors or users to customize not only the
508-
general use of ariaNotify on websites, but also individual notifications by notificationID (or specific notification
507+
users. `ariaNotify` offers `notificationId` as a mechanism to allow screen reader vendors or users to customize not only the
508+
general use of `ariaNotify` on websites, but also individual notifications by `notificationId` (or specific notification
509509
string instances in the limit).
510510

511511
**Tooling help**
512512

513513
It's very difficult today to test that ARIA live regions are working and how they are working. Tooling, [such as the
514514
work proposed here](https://docs.google.com/document/d/1ZRBC4VJwsb-dlLmcZJgYlz1qn7MmDwNKkyfbd8nbLEA/edit), should be
515-
available for content authors to validate the behavior of both ARIA live regions and ariaNotify.
515+
available for content authors to validate the behavior of both ARIA live regions and `ariaNotify`.
516516

517517
## Alternate Solutions
518518
The design of this API is loosely inspired by the [UIA Notification API](https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiaraisenotificationevent).
@@ -535,7 +535,7 @@ available for content authors to validate the behavior of both ARIA live regions
535535
browser's trusted UI.
536536
- Mitigations should be applied to suppress notifications when focus moves outside of the web content.
537537
- Additional mitigations to block certain trusted phrases related to the browser's trusted UI could be considered.
538-
- Implementations may choose to audibly differentiate notification phrases coming from ariaNotify in order to make it
538+
- Implementations may choose to audibly differentiate notification phrases coming from `ariaNotify` in order to make it
539539
clear that they are content author controlled.
540540
4. **Secure Context.** Does it make sense to offer this feature only to Secure Contexts? Should usage of this API be
541541
automatically granted to 3rd party browsing contexts? Currently thinking "no" in order to have maximum possibility of
@@ -544,4 +544,5 @@ available for content authors to validate the behavior of both ARIA live regions
544544
5. **Data Limits** (See [Security and Privacy Questionnaire
545545
#2.7](https://www.w3.org/TR/security-privacy-questionnaire/#send-to-platform)) Should there be a practical limit on the
546546
amount of text that can be sent in one parameter to the API? Just like multiple-call DoS attacks, one call with an
547-
enormous amount of text could tie up an AT or cause a hang as data is marshalled across boundaries.
547+
enormous amount of text could tie up an AT or cause a hang as data is marshalled across boundaries.
548+

0 commit comments

Comments
 (0)