Closed Bug 1494196 Opened 5 years ago Closed 3 months ago

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


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




112 Branch
Tracking Status
firefox112 --- fixed


(Reporter: Jamie, Assigned: nlapre)


(Blocks 1 open bug)


(Keywords: papercut)


(1 file)

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.
Keywords: papercut
See Also: → 1793073
Severity: normal → S3

This revision modifies the logic in CreateAccessible such that we create
Accessibles for elements that have ARIA roles (other than presentation, none) or
other ARIA attributes, even if those elements have the display: contents style.
This revision also adds tests to verify the above.

Assignee: nobody → nlapre
Pushed by
Create Accessible for elements with ARIA role, attributes and display: contents, r=Jamie
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.