haikuwebkit/LayoutTests/accessibility/aria-hidden-negates-no-visi...

76 lines
2.8 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<h1 hidden id="heading1_1">heading1.1</h1>
<h1 aria-hidden="true" id="heading1_2">heading1.2</h1>
<h1 hidden aria-hidden="true" id="heading1_3">heading1.3</h1>
<h1 hidden aria-hidden="false" id="heading2">heading2</h1>
<h1 style="display:none;" aria-hidden="false" id="heading3">heading3</h1>
<h1 style="visibility:hidden;" aria-hidden="false" id="heading4">heading4</h1>
<div hidden aria-hidden="false" id="hiddenDiv">HiddenText1</div>
<input type="text" aria-labelledby="hiddenDiv" id="textFieldWithHiddenLabeller">
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
<div>
<div aria-hidden="false">
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
<video hidden id="video">
Hidden content
</video>
</div>
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
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests ensures that aria-hidden=false will allow a node to be in the AX hierarchy even if it's not rendered or visible");
if (window.accessibilityController) {
// First groups of headings are actually hidde.n
var heading1_1 = accessibilityController.accessibleElementById("heading1_1");
shouldBeTrue("!heading1_1 || !heading1_1.isValid");
var heading1_2 = accessibilityController.accessibleElementById("heading1_2");
shouldBeTrue("!heading1_2 || !heading1_3.isValid");
var heading1_3 = accessibilityController.accessibleElementById("heading1_3");
shouldBeTrue("!heading1_3 || !heading1_3.isValid");
// These headings should be in AX tree despite being hidden.
var heading2 = accessibilityController.accessibleElementById("heading2");
shouldBe("heading2.role", "'AXRole: AXHeading'");
// Check that the order of these elements is correct based on DOM order.
var parent = heading2.parentElement();
shouldBeTrue("parent.childAtIndex(0).isEqual(heading2)");
var heading3 = accessibilityController.accessibleElementById("heading3");
shouldBe("heading3.role", "'AXRole: AXHeading'");
shouldBeTrue("parent.childAtIndex(1).isEqual(heading3)");
var heading4 = accessibilityController.accessibleElementById("heading4");
shouldBe("heading4.role", "'AXRole: AXHeading'");
shouldBeTrue("parent.childAtIndex(2).isEqual(heading4)");
// The aria-labelledby attribute should work even though hidden.
var textField = accessibilityController.accessibleElementById("textFieldWithHiddenLabeller");
debug("Textfield Title: " + textField.title);
// aria-hidden="false" need to be on each parent, including rendered parents.
var video = accessibilityController.accessibleElementById("video");
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
shouldBeTrue("!video || video.childrenCount == 0");
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>