Open Bug 2058734 Opened 4 months ago Updated 4 months ago

Consider teaching PageExtractor the full a11y tree of the page

Categories

(Core :: Machine Learning: On Device, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: gregtatum, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 external files)

In the "ARIA Authoring Practices Guide" there are a large collection of patterns for how to interpret the interaction elements on a page from an accessibility (a11y) perspective. PageExtractor could learn how to interpret all of these patterns when it's turning live webpages into text. The a11y controls are already designed to be machine readable, and approachable from natural language via screen readers.

Here we can lean into the values of the open accessible web, and use it to help us work programmatically with content on the web. This is similar to Bug 2045089, but more specifically about implementing this in a more holistic fashion. I can see how we can take all of the examples that make sense, and use them to drive a text representation.

Here the simplest first stab would be to handle every case for the button semantics. This is covered in Bug 2045089. However, we would have to re-derive all of the rules for a11y here, which are complicated, but well specified. Alternately we could look at leveraging the a11y tree that is already built in and available for our privileged code. However, this may have some unfortunate performance side effects across the browser. We should investigate this as well.

Represent an interactive button (role="button" or a native <button>) as inline
HTML co-located in the extracted text, e.g. <button>Print Page</button>,
carrying its accessible name (aria-labelledby / aria-label / text / title) and
its aria-pressed / disabled state. This lets a language model perceive the
control the way assistive technology presents it.

Extend browser_dom_extractor_a11y.js with the rest of the WAI-ARIA APG "Button"
pattern variants: toggle (aria-pressed), disabled, names from aria-label and
aria-labelledby, and native buttons. These pass with the current implementation.

Three variants that are not yet implemented are captured as todo_is tests
documenting the desired behavior: icon-only buttons (whose <svg>/<img> child
currently triggers block subdivision), inline buttons within prose, and menu
buttons (aria-haspopup / aria-expanded).

Attached file pageextractor-a11y.zip —

This attachment is all AI generated from the examples here, and is included just for examples. We should really use the linked guides as the source of truth. This is just for examples.

Here's a gist with my zip file for easier viewing. Again this is AI generated, but serves as a starting point for conversation on this topic: https://gist.github.com/gregtatum/64e50e4354e3d96bd074904a43d1e253

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: