WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Browsers and the accessibility tree

for

From: Jackson, Derek J
Date: Mar 3, 2020 7:02AM


Thank you! Both of these replies help a lot! The Rob Dodson a11y cast is a great overview, and the look at the code is exactly the technical detail I needed. I really appreciate the help!

All the Best,
Derek

—

Derek Jackson

Digital Accessibility Developer | Digital Accessibility Services
Harvard University Information Technology
1430 Massachusetts Ave, 4th Floor
Cambridge, MA 02138

he/him/his

On 3/2/20, 5:01 PM, "WebAIM-Forum on behalf of Mark Rogers" < <EMAIL REMOVED> on behalf of <EMAIL REMOVED> > wrote:

Hi Derek

It varies quite a lot depending on the browser, AT and accessibility API.

Safari calculates a11y tree relations from the DOM when the platform API is called - there's no actual tree stored in memory. For example, a call to IAccessible2::get_Parent calls AccessibilityObject::parentObjectUnignored which follows DOM parent links to find the first ancestor exposed as an accessible object:
https://github.com/WebKit/webkit/blob/9029c43e695bf886fffb15eec951f0605e34509b/Source/WebCore/accessibility/AccessibilityObject.cpp#L466

I think the Chromium a111y layer is mostly inherited from WebKit but has diverged since the blink/webkit fork.

Firefox creates a completely parallel a11y tree to the DOM, and only does this when a screen reader is connected to the browser. The code for the generic a11y tree is here:
https://dxr.mozilla.org/mozilla-central/source/accessible/generic/
It looks like Firefox creates the tree on page load and keeps it updated by listening to DOM changes:
https://dxr.mozilla.org/mozilla-central/source/accessible/generic/DocAccessible.cpp#1536

With NVDA and IE11 the a11y tree is actually calculated by NVDA using a mashup of MSAA and DOM calls (MSAA was the first a11y API so is more primitive than later APIs). I think it's calculated on the load event, then re-recalculated on events like click (and is prone to getting out of sync with the DOM).

Does that help?

Best Regards
Mark

--
Mark Rogers - <EMAIL REMOVED>
PowerMapper Software Ltd - www.powermapper.com
Registered in Scotland No 362274 Quartermile 2 Edinburgh EH3 9GL





On 02/03/2020, 21:02, "WebAIM-Forum on behalf of Jackson, Derek J" < <EMAIL REMOVED> on behalf of <EMAIL REMOVED> > wrote:

Hello,

I have a technical question about how a browser creates an accessibility tree. I am having a hard time finding anything that provides many details about how this works aside from it being a parallel structure to the DOM. I have found some references to the Accessibility tree getting built from the render tree, or based on the DOM, or as part of the layout/reflow process right before painting. Does anyone know of a resource they could point me to about the technical process that is used to build the accessibility tree in a browser? Or does anyone know off hand at what stage in the rendering engine the accessibility tree is created and from what model? Any help is greatly appreciated.

Thank you,
Derek

—

Derek Jackson

Digital Accessibility Developer | Digital Accessibility Services
Harvard University Information Technology
1430 Massachusetts Ave, 4th Floor
Cambridge, MA 02138

he/him/his