[Bug 27294] DOM needs a way to get element's computed ARIA role and computed label string

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27294

--- Comment #9 from James Craig <jcraig@apple.com> ---
(In reply to Anne from comment #4)
> Why do we put these on Element? 

Because roles and labels are not specific to HTML. Unless every display
language inherits from HTMLElement, these should be on Element.

> Why are they methods? 

Callable methods might be better for implementation performance (lazy getters)
since this would have to spin up additional accessibility code in most UAs. If
properties can be lazy getters, too, that's fine.

> And why can't computedRole just be role?

role should be a the read/write reflected attribute. computedRole is the
readonly calculated value of the matched role. For example:

var el = document.createElement("h1");

console.log(el.getAttribute("role")); // ""
console.log(el.role); // ""
console.log(el.computedRole); // "heading" (no other way to get this via the
DOM)

// reset the value
el.setAttribute("role", "foo link");
console.log(el.role); // "foo link"

// computed role is ~ first recognized/implemented role, or default for
tagName.
console.log(el.computedRole); // "link"

el.removeAttribute("role");
console.log(el.computedRole); // "heading" (back to the default)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 18 December 2014 11:32:11 UTC