Skip to content

Commit

Permalink
[ATSPI] Modal element containing only StaticText is ignored
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246329

Reviewed by Carlos Garcia Campos.

A modal element will not be set as the current modal when it has no
accessible content. But when using AT-SPI, an object with
AccessibilityRole::StaticText is ignored, since we expect its parent
to implement org.a11y.atspi.Text interface itself.

Fixes `accessibility/custom-elements/modal.html` time out.

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::modalElementHasAccessibleContent):

Canonical link: https://commits.webkit.org/257235@main
  • Loading branch information
obyknovenius authored and nt1m committed Dec 1, 2022
1 parent a26fae9 commit 99e0cc3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/WebCore/accessibility/AXObjectCache.cpp
Expand Up @@ -300,6 +300,14 @@ bool AXObjectCache::modalElementHasAccessibleContent(Element& element)
if (auto* axObject = getOrCreate(node)) {
if (!axObject->computeAccessibilityIsIgnored())
return true;

#if USE(ATSPI)
// When using ATSPI, an accessibility object with 'StaticText' role is ignored.
// Its content is exposed by its parent.
// Treat such elements as having accessible content.
if (axObject->roleValue() == AccessibilityRole::StaticText)
return true;
#endif
}

// Don't descend into subtrees for non-visible nodes.
Expand Down

0 comments on commit 99e0cc3

Please sign in to comment.