21
21
- [ The Accessibility Object Model] ( #the-accessibility-object-model )
22
22
- [ Phase 1: Modifying Accessible Properties] ( #phase-1-modifying-accessible-properties )
23
23
- [ Use cases for Accessible Properties] ( #use-cases-for-accessible-properties )
24
- - [ No reflection] ( #no-reflection )
24
+ - [ AOM and ARIA] ( #aom-and-aria )
25
+ - [ No reflection] ( #no-reflection )
26
+ - [ ARIA takes precedence] ( #aria-takes-precedence )
27
+ - [ Reasoning] ( #reasoning )
25
28
- [ Computed accessible properties] ( #computed-accessible-properties )
26
29
- [ Validation] ( #validation )
27
30
- [ Phase 2: Accessible Actions] ( #phase-2-accessible-actions )
28
31
- [ Phase 3: Virtual Accessibility Nodes] ( #phase-3-virtual-accessibility-nodes )
29
32
- [ Phase 4: Full Introspection of an Accessibility Tree] ( #phase-4-full-introspection-of-an-accessibility-tree )
33
+ - [ Why is accessing the computed properties being addressed last?] ( #why-is-accessing-the-computed-properties-being-addressed-last )
30
34
- [ Phases: Summary] ( #phases-summary )
31
35
- [ Audience for the proposed API] ( #audience-for-the-proposed-api )
32
36
- [ Next Steps] ( #next-steps )
@@ -42,6 +46,10 @@ This effort aims to create a JavaScript API
42
46
to allow developers to modify (and eventually explore) the accessibility tree
43
47
for an HTML page.
44
48
49
+ If you're already familiar with the accessibility tree and ARIA,
50
+ [ The Accessibility Object Model] ( #the-accessibility-object-model )
51
+ section is the discussion of the actual proposal.
52
+
45
53
## Background: assistive technology and the accessibility tree
46
54
47
55
Assistive technology, in this context, refers to a third party application
@@ -190,7 +198,7 @@ or can't be achieved without cumbersome workarounds.
190
198
191
199
## The Accessibility Object Model
192
200
193
- This spec proposes the * Accessibility Object Model* .
201
+ This spec proposes the * Accessibility Object Model* (AOM) .
194
202
We plan to split this work into four phases,
195
203
which will respectively allow authors to:
196
204
@@ -341,70 +349,80 @@ input.accessibleNode.activeDescendant = optionList.accessibleNode;
341
349
342
350
This would allow the relationship to be expressed naturally.
343
351
344
- #### No reflection
352
+ #### AOM and ARIA
353
+
354
+ While AOM and ARIA both affect the computed accessible properties of a node,
355
+ and have the same vocabulary,
356
+ they are separate interfaces.
345
357
346
- Even though there's correspondence between Accessible Properties and
347
- ARIA attributes, they are never reflected. Similarly, Accessible Properties
348
- do not reflect equivalent implicit properties of their associated DOM elements,
349
- either.
358
+ ##### No reflection
359
+
360
+ ARIA does not reflect to AOM:
361
+
362
+ ``` html
363
+ <div " clickBtn" role =" button" >Click here</div >
364
+ ```
350
365
351
366
``` js
352
- button = document .createElement (" button" );
353
- button .innerHTML = " Next" ;
354
- console .log (button .accessibleNode .role ); // null, not "button"
355
- console .log (button .accessibleNode .label ); // null, not "Next"
356
-
357
- button .setAttribute (" role" , " link" );
358
- button .setAttribute (" aria-label" , " Next Page" );
359
- console .log (button .accessibleNode .role ); // null, not "link"
360
- console .log (button .accessibleNode .label ); // null, not "Next Page"
367
+ console .log (clickBtn .accessibleNode .role ); // null, not "button"
361
368
```
362
369
363
- Similarly, setting Accessible Properties on an ` AccessibleNode ` does not
364
- affect corresponding ARIA attributes at all.
370
+ And AOM does not reflect to ARIA:
365
371
366
- ``` js
367
- button .accessibleNode .role = " menuitem" ;
368
- button .accessibleNode .label = " Next Page (Ctrl+N)" ;
369
- console .log (button .getAttribute (" role" )); // still "link"
370
- console .log (button .getAttribute (" aria-label" )); // still "Next Page"
372
+ ``` html
373
+ clickBtn.accessibleNode.role = "link";
374
+
375
+ console.log(clickBtn.getAttribute("role")); // Still "button"
371
376
```
372
377
373
- This is analogous to the ` style ` attribute, which allows
374
- reading and setting an element's local style, while
375
- ` getComputedStyle() ` allows access to the full computed style.
378
+ ##### ARIA takes precedence
379
+
380
+ In the case where and AOM Accessible Property and the corresponding ARIA attribute have different values,
381
+ the ARIA attribute takes precedence.
376
382
377
- Part of the reasoning behind this is that there are some cases in which
378
- Accessible Properties are more expressive than ARIA attributes - for example,
379
- referencing elements that don't have IDs. Since there would be no way to
380
- represent those cases as DOM attribute.
383
+ For example, in the case in the previous section,
384
+ ` clickBtn ` would have a computed role of ` "button" `
385
+ even though its ` accessibleNode ` has a ` role ` of ` "link" ` .
381
386
382
- Another reason is for efficiency and tidiness: setting a DOM attribute is more
383
- heavyweight than setting a property of an object from JavaScript. Authors who
384
- are concerned about the performance of their web application or the bloated
385
- size of their generated HTML will find using the Accessibility Object Model
386
- to be a more efficient alternative. It also promotes creating custom elements
387
- that are clean and fully encapsulate their own accessibility rather than
388
- leaking it.
387
+ ##### Reasoning
388
+
389
+ The reasons for these decisions are discussed in #60 ,
390
+ but in summary the benefits are:
391
+ - Authors can use ARIA to modify elements which apply their own default Accessibility Properties,
392
+ as in the case of Custom Elements;
393
+ - ARIA is still a source of truth in the DOM tree;
394
+ - There is no need to handle cases such as related nodes where Accessible Properties
395
+ can express things which ARIA cannot;
396
+ - Setting Accessible Properties will not have the performance implications
397
+ of setting a DOM attribute.
389
398
390
399
#### Computed accessible properties
391
400
392
- In Phase 4 the Accessibility Object Model spec will provide a way to get the computed
393
- value of accessibility properties.
401
+ Accessible Properties explicitly ** will not ** allow authors to access
402
+ the _ computed _ accessible node properties corresponding to a given DOM node:
394
403
395
- The reason this will be done via a separate mechanism is because the computed
396
- value of many accessible properties requires layout. Allowing web authors to query
397
- the computed value of an accessible property at any time via a simple property access
398
- would introduce confusing performance bottlenecks.
404
+ ``` html
405
+ <button id =" composeBtn" >Compose</button >
406
+ ```
407
+ ``` js
408
+ var composeBtn = document .getElementById (' composeBtn' );
409
+ console .log (composeBtn .accessibleNode .role ); // null, not "button"
410
+ console .log (composeBtn .accessibleNode .label ); // null, not "Compose"
411
+ ```
412
+
413
+ This is analogous to the ` style ` attribute,
414
+ which allows reading and setting an element's local style,
415
+ while ` getComputedStyle() ` allows access to the full computed style.
416
+
417
+ [ Phase 4] ( #phase-4-full-introspection-of-an-accessibility-tree ) will allow accessing the computed properties.
399
418
400
419
#### Validation
401
420
402
- Querying an Accessible Property can be used as a limited
403
- form of validation and feature detection.
421
+ Querying an Accessible Property can be used as a limited form of validation and feature detection.
404
422
405
- On an uninitialized ` AccessibleNode ` , properties that are supported by the
406
- browser will return ` null ` initially, while unsupported / unrecognized
407
- properties return ` undefined ` :
423
+ On an uninitialized ` AccessibleNode ` ,
424
+ properties that are supported by the browser will return ` null ` initially,
425
+ while unsupported / unrecognized properties return ` undefined ` :
408
426
409
427
``` js
410
428
console .log (el .accessibleNode .role ); // null
@@ -543,7 +561,7 @@ document.body.accessibleNode.removeChild(virtualNode);
543
561
544
562
In addition, calling appendChild on a node that's already inserted somewhere else
545
563
in the accessibility tree will implicitly remove it from its old location and
546
- append it to the
564
+ append it to the
547
565
548
566
Finally, the AOM also provides ` insertChild ` that's analogous to the DOM Node
549
567
insertChild method, taking a zero-based index and then a child.
@@ -613,6 +631,34 @@ This will make it possible to:
613
631
for example, detecting the exposed role of an element
614
632
and modifying the accessible help text to suit.
615
633
634
+ #### Why is accessing the computed properties being addressed last?
635
+
636
+ ** Consistency**
637
+ Currently, the accessibility tree is not standardized between browsers:
638
+ Each implements accessibility tree computation slightly differently.
639
+ In order for this API to be useful,
640
+ it needs to work consistently across browsers,
641
+ so that developers don't need to write special case code for each.
642
+
643
+ We want to take the appropriate time to ensure we can agree
644
+ on the details for how the tree should be computed
645
+ and represented.
646
+
647
+ ** Performance**
648
+ Computing the value of many accessible properties requires layout.
649
+ Allowing web authors to query the computed value of an accessible property
650
+ synchronously via a simple property access
651
+ would introduce confusing performance bottlenecks.
652
+
653
+ We will likely want to create an asynchronous mechanism for this reason,
654
+ meaning that it will not be part of the ` accessibleNode ` interface.
655
+
656
+ ** User experience**
657
+ Compared to the previous three phases,
658
+ accessing the computed accessibility tree will have the least direct impact on users.
659
+ In the spirit of the [ Priority of Constituencies] ( https://www.w3.org/TR/html-design-principles/#priority-of-constituencies ) ,
660
+ it makes sense to tackle this work last.
661
+
616
662
### Phases: Summary
617
663
618
664
![ All phases of the AOM shown on the flow chart] ( images/DOM-a11y-tree-AOM.png )
0 commit comments