WICG / aom

Accessibility Object Model
http://wicg.github.io/aom/
Other
571 stars 59 forks source link

Computed Accessibility tree access (Phase 4) #86

Open alice opened 7 years ago

alice commented 7 years ago

Some top of my head thoughts/questions:

alice commented 7 years ago

Total strawman proposal just to get some gut reactions to these choices:

let computedAXNode = await document.activeElement.accessibleNode.requestComputedNode();

// no need for label/labelledby etc, just get the computed name and description
console.log(computedAXNode.name, computedAXNode.description);  

// finally we can get the computed role!
console.log(computedAXNode.roleName);

// do we want a type taxonomy like DOM objects?
if (computedAXNode instanceof AccessibilitySlider) {
  console.log(computedAXNode.minValue);

// do some tree walking
let parent = computedAXNode.parent;
while (parent.parent)
  parent = parent.parent;
let rootAXNode = parent;

// get all the more obscure relations - 
// maybe this is a list of strings, maybe this is a dictionary?
var relations = computedAXNode.accessibleRelations;
alice commented 7 years ago

https://github.com/WICG/aom/issues/6 talks about use cases

minorninth commented 7 years ago

// no need for label/labelledby etc, just get the computed name and description console.log(computedAXNode.name, computedAXNode.description);

+1

// do we want a type taxonomy like DOM objects? if (computedAXNode instanceof AccessibilitySlider) { console.log(computedAXNode.minValue);

I vote no. If minValue doesn't apply to that role it should return undefined.

// do some tree walking let parent = computedAXNode.parent;

How about: let parent = await computedAXNode.requestParent()?

That way the implementation can be super lazy. For performance reasons we can try to return synchronously whenever possible, but we won't guarantee we will.

If we don't do that, what happens if you modify the accessibility tree and try to access the computed node's relationships synchronously - does it answer based on the previous snapshot, or does it block?

alice commented 7 years ago

Example WebDriver APIs which aren't available on the open web: https://www.w3.org/TR/webdriver/#pointer-actions https://www.w3.org/TR/webdriver/#dismiss-alert https://www.w3.org/TR/webdriver/#take-screenshot

alice commented 7 years ago

Would ComputedAccessibleNode be live?