Closed Bug 1824935 Opened 2 years ago Closed 2 years ago

Make it possible to get the computed ARIA role for a given Accessible

Categories

(Core :: Disability Access APIs, task)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

We want a simple way to expose the computed ARIA role. This will be used in WebDriver and Dev Tools.

Currently, Gecko has string roles, but many of them are different to ARIA role names. In addition, some roles map to a broader Gecko role and require info from elsewhere; e.g. landmarks map to roles::LANDMARK and you have to use the xml-roles object attribute to get the actual landmark. This is problematic for WebDriver (which expects ARIA roles as a standard). It's also confusing for web developers who use Dev Tools.

Assignee: nobody → jteh

IN addition to the landmark role (where Gecko maps multiple ARIA roles to a single Gecko role), there are cases where Gecko maps a single ARIA role to multiple Gecko roles depending on other things. For example, Gecko mapps ARIA role button to Gecko role PUSHBUTTON, TOGGLE_BUTTON or BUTTONMENU depending on states.

In my initial attempt at this, I modified the Gecko string roles in RoleMap.h to use ARIA role names wherever possible. For example, PUSHBUTTON got a string role of "button". Accessible::ComputedARIARole then had to deal with a bunch of exceptions. There were a few problems with this:

  1. For cases like button, we still needed role strings for "toggle button", etc. because they needed to be translatable separately from "button" for Android.
  2. There are some roles (e.g. INTERNAL_FRAME) that don't map to an ARIA role at all. We had no way of knowing that a string role wasn't a standard ARIA role, so we would just return "internal frame", etc. This probably isn't appropriate, since this is supposed to return standardised names.
  3. Our tests use the role strings when logging results. It's a bit confusing to have the role strings completely different in some cases to the role constants. We could fix this confusion by renaming our roles, but that's a much bigger lift.

So, I'm now mapping ARIA roles completely separately from our role strings.

This will soon be used to return standardized ARIA role names from a new function.

We will soon call LandmarkRole from a new function which returns an nsStaticAtom.
LandmarkRole always returns static atoms anyway, so formalize this.

This also exposes this via XPCOM.
This will be used by WebDriver and Dev Tools.

AccessibleNode isn't really standardized, but it makes sense to return standardized ARIA roles here rather than Gecko role strings.

Blocks: 1572512
Attachment #9328754 - Attachment is obsolete: true
Blocks: 1829046
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0370b0032eb6 part 1: Add ARIA roles to RoleMap. r=eeejay https://hg.mozilla.org/integration/autoland/rev/a8faf17fcce8 part 2: Have LandmarkRole return an nsStaticAtom. r=eeejay https://hg.mozilla.org/integration/autoland/rev/4effd0bdc4db part 3: Add Accessible::ComputedARIARole. r=eeejay

Backed out for causing multiple failures.



  • Pushes with failures - mochitests
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | accessible/tests/browser/role/browser_computedARIARole.js | computedARIARole for htmlTbody is correct - Got "group", expected "rowgroup"
Flags: needinfo?(jteh)
Flags: needinfo?(jteh)
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9397edd3365b part 1: Add ARIA roles to RoleMap. r=eeejay https://hg.mozilla.org/integration/autoland/rev/6d9cc86e46cf part 2: Have LandmarkRole return an nsStaticAtom. r=eeejay https://hg.mozilla.org/integration/autoland/rev/8d9039a48146 part 3: Add Accessible::ComputedARIARole. r=eeejay
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: