haikuwebkit/LayoutTests/accessibility/aria-modal-in-aria-hidden.html

56 lines
1.5 KiB
HTML
Raw Permalink Normal View History

AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Source/WebCore: Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): LayoutTests: * accessibility/aria-hidden-negates-no-visibility-expected.txt: * accessibility/aria-hidden-negates-no-visibility.html: * accessibility/aria-modal-in-aria-hidden-expected.txt: Added. * accessibility/aria-modal-in-aria-hidden.html: Added. * accessibility/aria-modal.html: * accessibility/mac/aria-modal-auto-focus.html: Canonical link: https://commits.webkit.org/226538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-29 18:54:16 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="bg">
<p id="bgContent">Other page content with <a href="#">a dummy focusable element</a></p>
</div>
<div id="container">
<div role="dialog" aria-modal="false" id="box">
<h3 id="myDialog">Just an example.</h3>
</div>
</div>
<script>
description("This tests that when something is aria-modal inside an aria-hidden it is ignored.");
window.jsTestIsAsync = true;
async function test() {
if (window.accessibilityController) {
shouldBeFalse("accessibilityController.accessibleElementById('bgContent').isIgnored");
await new Promise(requestAnimationFrame);
document.getElementById("box").setAttribute("aria-modal", "true");
await new Promise(requestAnimationFrame);
backgroundContent = accessibilityController.accessibleElementById('bgContent');
shouldBeTrue("!backgroundContent || backgroundContent.isIgnored");
await new Promise(requestAnimationFrame);
AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Source/WebCore: Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): LayoutTests: * accessibility/aria-hidden-negates-no-visibility-expected.txt: * accessibility/aria-hidden-negates-no-visibility.html: * accessibility/aria-modal-in-aria-hidden-expected.txt: Added. * accessibility/aria-modal-in-aria-hidden.html: Added. * accessibility/aria-modal.html: * accessibility/mac/aria-modal-auto-focus.html: Canonical link: https://commits.webkit.org/226538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-29 18:54:16 +00:00
document.getElementById("container").setAttribute("aria-hidden", "true");
AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Source/WebCore: Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): LayoutTests: * accessibility/aria-hidden-negates-no-visibility-expected.txt: * accessibility/aria-hidden-negates-no-visibility.html: * accessibility/aria-modal-in-aria-hidden-expected.txt: Added. * accessibility/aria-modal-in-aria-hidden.html: Added. * accessibility/aria-modal.html: * accessibility/mac/aria-modal-auto-focus.html: Canonical link: https://commits.webkit.org/226538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-29 18:54:16 +00:00
await new Promise(requestAnimationFrame);
AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Source/WebCore: Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): LayoutTests: * accessibility/aria-hidden-negates-no-visibility-expected.txt: * accessibility/aria-hidden-negates-no-visibility.html: * accessibility/aria-modal-in-aria-hidden-expected.txt: Added. * accessibility/aria-modal-in-aria-hidden.html: Added. * accessibility/aria-modal.html: * accessibility/mac/aria-modal-auto-focus.html: Canonical link: https://commits.webkit.org/226538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-29 18:54:16 +00:00
shouldBeFalse("accessibilityController.accessibleElementById('bgContent').isIgnored");
finishJSTest();
}
}
test();
AX: aria-modal nodes wrapped in aria-hidden are not honored https://bugs.webkit.org/show_bug.cgi?id=212849 <rdar://problem/64047019> Reviewed by Zalan Bujtas. Source/WebCore: Test: accessibility/aria-modal-in-aria-hidden.html If aria-modal was wrapped inside aria-hidden, we were still processing that as the modal node. Fixing that uncovered a host of very finicky issues related to aria-modal. 1. We were processing modal status immediately instead of after a delay, so visibility requirements were not correct. 2. In handleModalChange: We were processing multiple modal nodes perhaps incorrectly (the spec doesn't account for multiple modal nodes). - had to update a test to turn off modal status before adding a new modal node 3. Changed the modal node to a WeakPtr 4. In isNodeAriaVisible: We stopped processing for visibile with aria-hidden as soon as we hit a renderable block, but that means it won't account for nodes higher in the tree with aria-hidden. 5. In handleAttributeChange: if aria-hidden changes, we should update modal status if needed. 6. In focusModalNodeTimerFired: we need to verify the element is still live, otherwise it can lead to a crash. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::deferModalChange): (WebCore::AXObjectCache::focusModalNodeTimerFired): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::isNodeAriaVisible): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::deferModalChange): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::firstChild const): (WebCore::AccessibilityRenderObject::lastChild const): LayoutTests: * accessibility/aria-hidden-negates-no-visibility-expected.txt: * accessibility/aria-hidden-negates-no-visibility.html: * accessibility/aria-modal-in-aria-hidden-expected.txt: Added. * accessibility/aria-modal-in-aria-hidden.html: Added. * accessibility/aria-modal.html: * accessibility/mac/aria-modal-auto-focus.html: Canonical link: https://commits.webkit.org/226538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-29 18:54:16 +00:00
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>