There is an issue that when the element is hidden because its ancestor has 'content-visibility:hidden', it still appears in the accessibility tree. Depending on CSS Containment Spec (https://www.w3.org/TR/css-contain-2/#cv-a11y), it should be omitted from the accessibility tree. This change fixes the issue above. The approach is not to create the node in accessibility tree if the element has any ancestor specified with 'content-visibility:hidden'. This patch can be tested such as: (1) Check if the accessibility tree is created correctly ./mach test accessible/tests/browser/tree/browser_css_content_visibility.js (2) Check if the accessibility tree is updated correctly ./mach test accessible/tests/browser/e10s/browser_treeupdate_csscontentvisibility.js Differential Revision: https://phabricator.services.mozilla.com/D159879