Closed Bug 1572317 Opened 5 years ago Closed 5 years ago

Relocated elements not pruned when container is hidden

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- unaffected
firefox68 --- unaffected
firefox69 --- unaffected
firefox70 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Discovered this while trying to get aria-owns working properly on the address bar (bug 1567377).

STR:

  1. Open this test case:
    data:text/html,<div role="combobox" aria-owns="listbox"></div><div id="container"><div id="listbox" role="listbox"></div></div><button onClick="container.hidden = true; listbox.innerHTML = `<div role='option'>1</div>`;">Break things</button><button onClick="container.hidden = false;">Break more things</button>
  2. Observe that in the accessibility tree, there is an editcombobox containing a combobox list. The combobox list does not have the invisible state.
  3. Press the "Break things" button.
  4. In the accessibility tree, examine the children of the editcombobox.
    • Expected: There should be no children.
    • Actual: The combobox list is still there. It has the invisible state.
  5. Press the "Break more things" button.
  6. In the accessibility tree, examine the children of the editcombobox.
    • Observe: As expected, the combobox list is there and it does not have the invisible state.
  7. In the accessibility tree, examine the children of the combobox list.
    • Expected: There should be a combobox option child.
    • Actual: There is a text leaf child.

This is not fixed by the patch for bug 1571616 (I applied and tested locally).

In PruneOrInsertSubtree, when we remove something (e.g. because its accessible no longer has a frame), we call ContentRemoved(acc) and return early. That removes the accessible and its descendant accessibles. However, relocated accessibles aren't descendant accessibles, even though they're descendant DOM nodes. I think we need to remove Accessibles for descendant DOM nodes here.

Can we just call ContentRemoved on the node instead of the Accessible? That will iterate through descendant DOM nodes.

Note that in html, node.hidden = whatever doesn't do anything.

Oh, hmm, even after reading that I'm not sure what it does. In XUL (this includes the urlbar) hidden is just a shortcut for style.display="none".

Removing an Accessible removes descendants in the a11y tree.
However, there may be DOM descendants which have been relocated elsewhere in the a11y tree.
Their DOM nodes are now hidden as well, so we need to remove those Accessibles too.
In addition to Accessibles remaining in the tree when they shouldn't, failing to remove relocated Accessibles caused problems later on when a relocated Accessible was shown with new descendants.

Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/09dfba0277d1
When removing an Accessible because it lost its frame, remove Accessibles for DOM descendants as well. r=eeejay
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Assignee: nobody → jteh
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: