Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
AX: An unnecessary group is created for every block-flow box with no …
…other useful AX semantics https://bugs.webkit.org/show_bug.cgi?id=243373 Reviewed by Chris Fleizach. At the end of AccessibilityRenderObject::determineAccessibilityRole, we have this logic: if (m_renderer->isRenderBlockFlow()) return m_renderer->isAnonymousBlock() ? AccessibilityRole::TextGroup : AccessibilityRole::Group; This causes us to create a group for every block-flow box that doesn't otherwise have any useful AX semantics. This is problematic because: 1. It makes the AX tree diverge from the DOM in a way that makes inserting node-only children (e.g. those with display:contents) at the right index in AccessibilityRenderObject::addNodeOnlyChildren hard or impossible 2. Causes wasted work for WebKit by having to created isolated objects for these unnecessary groups 3. Causes wasted work for AX clients who have to filter through these semantics-less groups This patch removes this fallback (for Cocoa platforms). Because these groups are so pervasive throughout our tests, this required a lot of test changes, mostly removing now-unnecessary nested calls to `childAtIndex()` and removing the groups from accessibility tree text dumps. This change is required to fix: https://bugs.webkit.org/show_bug.cgi?id=242779 AX: display:contents elements are inserted in the wrong position when they have inline renderer siblings Because the reason we insert node-only objects in the wrong position is due to the existence of the anonymous block boxes created implicitly by inline renderers. The groups created by these boxes cause a restructuring of the AX tree that is difficult to work around, as the inline renderer AX objects become children of the anonymous block box AX object and are therefore no longer siblings in the AX tree to their DOM tree siblings. rdar://problem/97840402 * LayoutTests/accessibility/aria-disabled.html: * LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html: * LayoutTests/accessibility/aria-used-on-image-maps.html: * LayoutTests/accessibility/deleting-iframe-destroys-axcache.html: * LayoutTests/accessibility/double-nested-inline-element-missing-from-tree-expected.txt: * LayoutTests/accessibility/dynamically-changing-iframe-remains-accessible-expected.txt: * LayoutTests/accessibility/dynamically-changing-iframe-remains-accessible.html: * LayoutTests/accessibility/hidden-th-still-column-header-expected.txt: * LayoutTests/accessibility/hidden-th-still-column-header.html: * LayoutTests/accessibility/iframe-bastardization-expected.txt: * LayoutTests/accessibility/iframe-bastardization.html: * LayoutTests/accessibility/ignore-modals-without-any-content.html: * LayoutTests/accessibility/ignore-spacer-elements.html: * LayoutTests/accessibility/ignored-aria-role-description-expected.txt: * LayoutTests/accessibility/img-aria-button-alt-tag.html: * LayoutTests/accessibility/img-fallsback-to-title.html: * LayoutTests/accessibility/mac/aria-tree-item-children-expected.txt: * LayoutTests/accessibility/mac/aria-tree-item-children.html: * LayoutTests/accessibility/mac/canvas.html: * LayoutTests/accessibility/mac/element-focus-expected.txt: * LayoutTests/accessibility/mac/element-focus.html: * LayoutTests/accessibility/mac/element-level-expected.txt: * LayoutTests/accessibility/mac/element-level.html: * LayoutTests/accessibility/mac/figure-element-expected.txt: * LayoutTests/accessibility/mac/figure-element.html: * LayoutTests/accessibility/mac/html-section-elements-expected.txt: * LayoutTests/accessibility/mac/html-section-elements.html: * LayoutTests/accessibility/mac/iframe-aria-hidden-expected.txt: * LayoutTests/accessibility/mac/iframe-aria-hidden.html: * LayoutTests/accessibility/mac/iframe-pdf-expected.txt: * LayoutTests/accessibility/mac/iframe-pdf.html: * LayoutTests/accessibility/mac/label-element-with-hidden-control.html: * LayoutTests/accessibility/mac/math-alttext.html: * LayoutTests/accessibility/mac/nested-inline-elements-children.html: * LayoutTests/accessibility/mac/pseudo-element-text-markers-expected.txt: * LayoutTests/accessibility/mac/pseudo-element-text-markers.html: * LayoutTests/accessibility/mac/slider-allows-title-ui-element.html: * LayoutTests/accessibility/mac/stale-textmarker-crash.html: * LayoutTests/accessibility/mac/supports-focus-setting.html: * LayoutTests/accessibility/nochildren-elements.html: * LayoutTests/accessibility/table-cell-display-block.html: * LayoutTests/accessibility/deleting-iframe-destroys-axcache-expected.txt * LayoutTests/accessibility/mac/figure-element-expected.txt * LayoutTests/accessibility/mac/figure-element.html * LayoutTests/accessibility/mac/html-slider-indicator-expected.txt * LayoutTests/accessibility/mac/search-predicate-visited-links-expected.txt * LayoutTests/accessibility/mac/search-predicate-visited-links.html * LayoutTests/platform/ios/accessibility/aria-roles-unignored-expected.txt * LayoutTests/platform/mac-wk1/accessibility/dynamically-changing-iframe-remains-accessible-expected.txt * LayoutTests/platform/mac-wk1/accessibility/roles-exposed-expected.txt * LayoutTests/platform/mac/TestExpectations * LayoutTests/platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt -> LayoutTests/platform/mac-wk1/accessibility/deleting-iframe-destroys-axcache-expected.txt * LayoutTests/platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: * LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt: * LayoutTests/platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt: * LayoutTests/platform/mac/accessibility/aria-menubar-menuitems-expected.txt: * LayoutTests/platform/mac/accessibility/generated-content-with-display-table-crash-expected.txt: * LayoutTests/platform/mac/accessibility/image-with-alt-and-map-expected.txt: * LayoutTests/platform/mac/accessibility/img-fallsback-to-title-expected.txt: * LayoutTests/platform/mac/accessibility/lists-expected.txt: Remove now-unnecessary nested calls to `childAtIndex()` and remove groups from accessibility tree text dumps. * LayoutTests/accessibility/aria-roles-unignored-expected.txt: Added. * LayoutTests/accessibility/aria-roles-unignored.html: Added. We originally started exposing every block-flow box as a group here: 1dffe62 (AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>) I've added this test to ensure we don't regress this behavior with this patch. * LayoutTests/platform/win/TestExpectations: * LayoutTests/platform/glib/TestExpectations: Disable new test aria-roles-unignored.html. * LayoutTests/platform/ios/TestExpectations Enable new test aria-roles-unignored.html. * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::determineAccessibilityRole): Stop giving a role to block-box flows with no other useful AX semantics on Cocoa platforms. This change should be made for other platforms, but doing so causes lots of failing tests that need to be worked through. Canonical link: https://commits.webkit.org/253038@main
- Loading branch information
Showing
66 changed files
with
271 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
LayoutTests/accessibility/aria-roles-unignored-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This tests that ARIA roles are not ignored for 'p', 'label', 'form' and 'div' elements. | ||
|
||
AXRole: AXWebArea | ||
AXRole: AXGroup | ||
AXRole: AXStaticText | ||
AXValue: Simple paragraph | ||
AXRole: AXTable | ||
AXRole: AXGroup | ||
AXRole: AXStaticText | ||
AXValue: A label | ||
AXRole: AXStaticText | ||
AXValue: A label | ||
AXRole: AXHeading | ||
AXRole: AXStaticText | ||
AXValue: Who said label? It's a heading! | ||
AXRole: AXGroup | ||
AXRole: AXStaticText | ||
AXValue: A form with a button | ||
AXRole: AXButton | ||
AXRole: AXButton | ||
AXRole: AXGroup | ||
AXRole: AXStaticText | ||
AXValue: Just some text inside a div | ||
AXRole: AXTextField | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
|
||
<div id="content"> | ||
<p>Simple paragraph</p> | ||
<p role="grid">A paragraph pretending to be a table</p> | ||
|
||
<label>A label</label> | ||
<label role="heading">Who said label? It's a heading!</label> | ||
|
||
<form>A form with a button <button name="button" value="Button">Click me!</button></form> | ||
<form role="button">Just a button <button name="button" value="Button">Click me!</button></form> | ||
|
||
<div>Just some text inside a div</div> | ||
<div role="textbox">This div is contains a textbox (an entry)</div> | ||
</div> | ||
|
||
<script> | ||
|
||
var testOutput = "This tests that ARIA roles are not ignored for 'p', 'label', 'form' and 'div' elements.\n\n"; | ||
|
||
function dumpTree(axElement, indent = 0) { | ||
if (!axElement) | ||
return ""; | ||
|
||
let indentStr = ""; | ||
for (let i = 0; i < indent; i++) | ||
indentStr += " "; | ||
|
||
let str = `${indentStr}${axElement.role}\n` | ||
if (axElement.role && axElement.role.includes("StaticText")) | ||
str += `${indentStr}${accessibilityController.platformName === "ios" ? axElement.description : axElement.stringValue}\n` | ||
|
||
for (let i = 0; i < axElement.childrenCount; ++i) | ||
str += dumpTree(axElement.childAtIndex(i), indent + 1); | ||
|
||
return str; | ||
} | ||
|
||
if (window.accessibilityController) { | ||
testOutput += dumpTree(accessibilityController.rootElement.childAtIndex(0)); | ||
|
||
document.getElementById("content").style.visibility = "hidden"; | ||
debug(testOutput); | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
LayoutTests/accessibility/deleting-iframe-destroys-axcache-expected.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.