Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4170dc9cf75853ff467290575972ddd2ab8dff6a
https://github.com/WebKit/WebKit/commit/4170dc9cf75853ff467290575972ddd2ab8dff6a
Author: Tyler Wilcock <[email protected]>
Date: 2026-05-06 (Wed, 06 May 2026)
Changed paths:
A
LayoutTests/accessibility/aria-hidden-modal-override-when-page-empty-expected.txt
A LayoutTests/accessibility/aria-hidden-modal-override-when-page-empty.html
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
M Source/WebCore/accessibility/AccessibilityObject.cpp
Log Message:
-----------
AX: Override aria-hidden on a modal when the page would otherwise be
completely empty due to inertness
https://bugs.webkit.org/show_bug.cgi?id=314165
rdar://176326010
Reviewed by Dominic Mazzoni.
On a very popular webpage, the web developer added an aria-modal to the
page, and used JavaScript to make all other content outside the modal
inert. This is reasonable, but unfortunately they forget to remove
aria-hidden="true" from the modal's container element, meaning the page
remains empty forever.
To fix this, we start detecting this scenario during modalNode() queries. When
the page has zero unignored content objects and a modal element exists
that is blocked by an ancestor aria-hidden, we override aria-hidden on
that ancestor using the existing shouldIgnoreARIAHidden mechanism.
To make the "is the page empty" check O(1), we maintain an unignored
content object counter that is incremented/decremented during
ignored-state transitions in isIgnoredWithoutCache and decremented in
the AccessibilityObject destructor. Structural roles (web areas, mock
objects, scroll bars, etc.) are excluded from the count since they
don't represent meaningful content, and the lifetime model for mock
objects is broken (we leak all of them), so including them in the count
would make it difficult to maintain.
The override check is armed lazily: only when aria-hidden is set to
true, when an element becomes inert/invisible, or when modal elements
are found. There is no cost on pages that don't hit this pattern.
*
LayoutTests/accessibility/aria-hidden-modal-override-when-page-empty-expected.txt:
Added.
* LayoutTests/accessibility/aria-hidden-modal-override-when-page-empty.html:
Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::findModalNodes):
(WebCore::AXObjectCache::modalNode):
(WebCore::AXObjectCache::onInertOrVisibilityChange):
(WebCore::AXObjectCache::handleAttributeChange):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::~AccessibilityObject):
(WebCore::AccessibilityObject::isIgnoredWithoutCache const):
Canonical link: https://commits.webkit.org/312744@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications