Open Bug 1494196 Opened 2 years ago Updated 7 months ago

Element with ARIA role and display: contents doesn't get an accessible


(Core :: Disability Access APIs, defect, P3)





(Reporter: Jamie, Unassigned)


(Blocks 1 open bug)


1. Open this test case:
data:text/html,<div role="list" style="display: contents;"><div role="listitem">foo</div></div>
2. Use the Accessibility Inspector to examine the tree.
Expected: document -> list -> list item
Actual: document -> list item

If a display: contents element has an ARIA role, we should create an accessible for it, just like we do for MarkupMap.
See Also: → 1455357
See Also: → 1500958
Notes about fixing this:
in nsAccessibilityService::CreateAccessible, at around line 1073, we have this block:

    if (content->IsElement() && content->AsElement()->IsDisplayContents()) {

Within that block, we create accessibles for display: contents, but *only* if there is an entry in the MarkupMap. We must also create an accessible if there are ARIA attributes. I think we can use MustBeAccessible() for this, but it needs to be tweaked so it doesn't assume a frame.

For most cases, we just want a HyperTextAccessible. However, ARIA grids are a notable exception. There is a block of code around line 1195 which deals with this, starting with this code:

    if (isARIATablePart && (!newAcc || newAcc->IsGenericHyperText())) {

We'll need to split that out (probably into a function) and use it in both places.
You need to log in before you can comment on or make changes to this bug.