Title: [283078] trunk
Revision
283078
Author
[email protected]
Date
2021-09-25 01:07:19 -0700 (Sat, 25 Sep 2021)

Log Message

AX: aria-expanded is no longer supported on quite a few roles in ARIA 1.2
https://bugs.webkit.org/show_bug.cgi?id=230609

Reviewed by Chris Fleizach.

Source/WebCore:

We were exposing aria-expanded on any element where it was explicitly
given a valid value (true/false). We should only expose it on roles where
aria-expanded is a supported property. In addition, the number of roles
where aria-expanded is a supported property was greatly reduced in ARIA 1.2.
This commit brings us in alignment with the spec.

Test: accessibility/aria-expanded-supported-roles.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::supportsExpanded const):
(WebCore::AccessibilityObject::isExpanded const):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):

LayoutTests:

* accessibility/aria-expanded-supported-roles.html: Added.
* accessibility/mac/aria-expanded-not-exposed-when-undefined.html: Updated.
* accessibility/mac/aria-expanded-standard-items.html: Updated.
* platform/glib/accessibility/aria-expanded-supported-roles-expected.txt: Added.
* platform/mac/accessibility/aria-expanded-supported-roles-expected.txt: Added.
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283077 => 283078)


--- trunk/LayoutTests/ChangeLog	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/LayoutTests/ChangeLog	2021-09-25 08:07:19 UTC (rev 283078)
@@ -1,3 +1,17 @@
+2021-09-25  Joanmarie Diggs  <[email protected]>
+
+        AX: aria-expanded is no longer supported on quite a few roles in ARIA 1.2
+        https://bugs.webkit.org/show_bug.cgi?id=230609
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-expanded-supported-roles.html: Added.
+        * accessibility/mac/aria-expanded-not-exposed-when-undefined.html: Updated.
+        * accessibility/mac/aria-expanded-standard-items.html: Updated.
+        * platform/glib/accessibility/aria-expanded-supported-roles-expected.txt: Added.
+        * platform/mac/accessibility/aria-expanded-supported-roles-expected.txt: Added.
+        * platform/win/TestExpectations:
+
 2021-09-24  Eric Hutchison  <[email protected]>
 
         [ Catalina BigSur Debug ] fast/workers/use-machine-stack.html is a flaky crash.

Added: trunk/LayoutTests/accessibility/aria-expanded-supported-roles.html (0 => 283078)


--- trunk/LayoutTests/accessibility/aria-expanded-supported-roles.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-expanded-supported-roles.html	2021-09-25 08:07:19 UTC (rev 283078)
@@ -0,0 +1,105 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+<div id="content">
+<div id="alert" role="alert" aria-expanded="true"></div>
+<div id="alertdialog" role="alertdialog" aria-expanded="true"></div>
+<div id="application" role="application" aria-expanded="true"></div>
+<div id="article" role="article" aria-expanded="true"></div>
+<div id="banner" role="banner" aria-expanded="true"></div>
+<div id="blockquote" role="blockquote" aria-expanded="true"></div>
+<div id="button" role="button" aria-expanded="true"></div>
+<div id="caption" role="caption" aria-expanded="true"></div>
+<div id="cell" role="cell" aria-expanded="true"></div>
+<div id="checkbox" role="checkbox" aria-expanded="true"></div>
+<div id="columnheader" role="columnheader" aria-expanded="true"></div>
+<div id="combobox" role="combobox" aria-expanded="true"></div>
+<div id="complementary" role="complementary" aria-expanded="true"></div>
+<div id="contentinfo" role="contentinfo" aria-expanded="true"></div>
+<div id="definition" role="definition" aria-expanded="true"></div>
+<div id="deletion" role="deletion" aria-expanded="true"></div>
+<div id="dialog" role="dialog" aria-expanded="true"></div>
+<div id="directory" role="directory" aria-expanded="true"></div>
+<div id="document" role="document" aria-expanded="true"></div>
+<div id="emphasis" role="emphasis" aria-expanded="true"></div>
+<div id="feed" role="feed" aria-expanded="true"></div>
+<div id="figure" role="figure" aria-expanded="true"></div>
+<div id="form" role="form" aria-expanded="true"></div>
+<div id="generic" role="generic" aria-expanded="true"></div>
+<div id="grid" role="grid" aria-expanded="true"></div>
+<div id="gridcell" role="gridcell" aria-expanded="true"></div>
+<div id="group" role="group" aria-expanded="true"></div>
+<div id="heading" role="heading" aria-expanded="true"></div>
+<div id="img" role="img" aria-expanded="true"></div>
+<div id="insertion" role="insertion" aria-expanded="true"></div>
+<div id="label" role="label" aria-expanded="true"></div>
+<div id="legend" role="legend" aria-expanded="true"></div>
+<div id="link" role="link" aria-expanded="true"></div>
+<div id="list" role="list" aria-expanded="true"></div>
+<div id="listbox" role="listbox" aria-expanded="true"></div>
+<div id="listitem" role="listitem" aria-expanded="true"></div>
+<div id="log" role="log" aria-expanded="true"></div>
+<div id="main" role="main" aria-expanded="true"></div>
+<div id="marquee" role="marquee" aria-expanded="true"></div>
+<div id="math" role="math" aria-expanded="true"></div>
+<div id="menu" role="menu" aria-expanded="true"></div>
+<div id="menubar" role="menubar" aria-expanded="true"></div>
+<div id="menuitem" role="menuitem" aria-expanded="true"></div>
+<div id="menuitemcheckbox" role="menuitemcheckbox" aria-expanded="true"></div>
+<div id="menuitemradio" role="menuitemradio" aria-expanded="true"></div>
+<div id="meter" role="meter" aria-expanded="true"></div>
+<div id="navigation" role="navigation" aria-expanded="true"></div>
+<div id="none" role="none" aria-expanded="true"></div>
+<div id="note" role="note" aria-expanded="true"></div>
+<div id="option" role="option" aria-expanded="true"></div>
+<div id="paragraph" role="paragraph" aria-expanded="true"></div>
+<div id="presentation" role="presentation" aria-expanded="true"></div>
+<div id="progressbar" role="progressbar" aria-expanded="true"></div>
+<div id="radio" role="radio" aria-expanded="true"></div>
+<div id="radiogroup" role="radiogroup" aria-expanded="true"></div>
+<div id="region" role="region" aria-expanded="true"></div>
+<div id="row" role="row" aria-expanded="true"></div>
+<div id="rowheader" role="rowheader" aria-expanded="true"></div>
+<div id="scrollbar" role="scrollbar" aria-expanded="true"></div>
+<div id="search" role="search" aria-expanded="true"></div>
+<div id="searchbox" role="searchbox" aria-expanded="true"></div>
+<div id="separator" role="separator" aria-expanded="true"></div>
+<div id="splitter" role="separator" aria-expanded="true" tabindex="0"></div>
+<div id="slider" role="slider" aria-expanded="true"></div>
+<div id="spinbutton" role="spinbutton" aria-expanded="true"></div>
+<div id="status" role="status" aria-expanded="true"></div>
+<div id="strong" role="strong" aria-expanded="true"></div>
+<div id="subscript" role="subscript" aria-expanded="true"></div>
+<div id="superscript" role="superscript" aria-expanded="true"></div>
+<div id="switch" role="switch" aria-expanded="true"></div>
+<div id="tab" role="tab" aria-expanded="true"></div>
+<div id="table" role="table" aria-expanded="true"></div>
+<div id="tablist" role="tablist" aria-expanded="true"></div>
+<div id="tabpanel" role="tabpanel" aria-expanded="true"></div>
+<div id="term" role="term" aria-expanded="true"></div>
+<div id="textbox" role="textbox" aria-expanded="true"></div>
+<div id="time" role="time" aria-expanded="true"></div>
+<div id="timer" role="timer" aria-expanded="true"></div>
+<div id="toolbar" role="toolbar" aria-expanded="true"></div>
+<div id="tooltip" role="tooltip" aria-expanded="true"></div>
+<div id="tree" role="tree" aria-expanded="true"></div>
+<div id="treegrid" role="treegrid" aria-expanded="true"></div>
+<div id="treeitem" role="treeitem" aria-expanded="true"></div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Verify which roles support aria-expanded.");
+if (window.accessibilityController) {
+    Array.from(document.getElementById("content").children).forEach(element => {
+        var axElement = accessibilityController.accessibleElementById(element.id);
+        if (axElement && axElement.isExpanded)
+            debug(axElement.role + " is expanded");
+    });
+    document.getElementById("content").style.visibility = "hidden";
+}
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/accessibility/mac/aria-expanded-not-exposed-when-undefined.html (283077 => 283078)


--- trunk/LayoutTests/accessibility/mac/aria-expanded-not-exposed-when-undefined.html	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/LayoutTests/accessibility/mac/aria-expanded-not-exposed-when-undefined.html	2021-09-25 08:07:19 UTC (rev 283078)
@@ -7,11 +7,11 @@
 
 <div id="content">
 
-<div id="test1" role="tabpanel" aria-expanded="true">Test 1</div>
-<div id="test2" role="tabpanel" aria-expanded="false">Test 2</div>
-<div id="test3" role="tabpanel" aria-expanded="asdfasdf">Test 3</div>
-<div id="test4" role="tabpanel" aria-expanded="">Test 4</div>
-<div id="test5" role="tabpanel">Test 5</div>
+<div id="test1" role="tab" aria-expanded="true">Test 1</div>
+<div id="test2" role="tab" aria-expanded="false">Test 2</div>
+<div id="test3" role="tab" aria-expanded="asdfasdf">Test 3</div>
+<div id="test4" role="tab" aria-expanded="">Test 4</div>
+<div id="test5" role="tab">Test 5</div>
 
 </div>
 

Modified: trunk/LayoutTests/accessibility/mac/aria-expanded-standard-items.html (283077 => 283078)


--- trunk/LayoutTests/accessibility/mac/aria-expanded-standard-items.html	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/LayoutTests/accessibility/mac/aria-expanded-standard-items.html	2021-09-25 08:07:19 UTC (rev 283078)
@@ -6,7 +6,7 @@
 <body id="body">
 
 <div tabindex="0" id="button" role="button" aria-expanded="true">foo</div>
-<div tabindex="0" id="heading" role="heading" aria-expanded="true">bar</div>
+<div tabindex="0" id="application" role="application" aria-expanded="true">bar</div>
 
 <p id="description"></p>
 <div id="console"></div>
@@ -21,7 +21,7 @@
         shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXButton'");
         shouldBe("accessibilityController.focusedElement.isExpanded", "true");
 
-        document.getElementById("heading").focus();
+        document.getElementById("application").focus();
         shouldBe("accessibilityController.focusedElement.isExpanded", "true");
 
         shouldBe("accessibilityController.focusedElement.childAtIndex(0).isExpanded", "false");

Added: trunk/LayoutTests/platform/glib/accessibility/aria-expanded-supported-roles-expected.txt (0 => 283078)


--- trunk/LayoutTests/platform/glib/accessibility/aria-expanded-supported-roles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/glib/accessibility/aria-expanded-supported-roles-expected.txt	2021-09-25 08:07:19 UTC (rev 283078)
@@ -0,0 +1,23 @@
+Verify which roles support aria-expanded.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXEmbedded is expanded
+AXRole: AXButton is expanded
+AXRole: AXCheckBox is expanded
+AXRole: AXColumnHeader is expanded
+AXRole: AXComboBox is expanded
+AXRole: AXCell is expanded
+AXRole: AXListBox is expanded
+AXRole: AXMenuItem is expanded
+AXRole: AXCheckMenuItem is expanded
+AXRole: AXRadioMenuItem is expanded
+AXRole: AXRow is expanded
+AXRole: AXRowHeader is expanded
+AXRole: AXToggleButton is expanded
+AXRole: AXTab is expanded
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/aria-expanded-supported-roles-expected.txt (0 => 283078)


--- trunk/LayoutTests/platform/mac/accessibility/aria-expanded-supported-roles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-expanded-supported-roles-expected.txt	2021-09-25 08:07:19 UTC (rev 283078)
@@ -0,0 +1,23 @@
+Verify which roles support aria-expanded.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup is expanded
+AXRole: AXButton is expanded
+AXRole: AXCheckBox is expanded
+AXRole: AXCell is expanded
+AXRole: AXComboBox is expanded
+AXRole: AXCell is expanded
+AXRole: AXList is expanded
+AXRole: AXMenuItem is expanded
+AXRole: AXMenuItem is expanded
+AXRole: AXMenuItem is expanded
+AXRole: AXRow is expanded
+AXRole: AXCell is expanded
+AXRole: AXCheckBox is expanded
+AXRole: AXRadioButton is expanded
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/platform/win/TestExpectations (283077 => 283078)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-09-25 08:07:19 UTC (rev 283078)
@@ -1459,6 +1459,7 @@
 webkit.org/b/140798 [ Release ] accessibility/aria-switch-text.html [ Skip ]
 webkit.org/b/140798 [ Debug ] accessibility/aria-switch-text.html [ Skip ]
 webkit.org/b/193371 accessibility/set-selected-editable.html [ Skip ]
+webkit.org/b/140798 accessibility/aria-expanded-supported-roles.html [ Skip ]
 
 # The following timeouts are caused by the same problem: [ Failure ]
 webkit.org/b/126066 accessibility/loading-iframe-updates-axtree.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (283077 => 283078)


--- trunk/Source/WebCore/ChangeLog	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/Source/WebCore/ChangeLog	2021-09-25 08:07:19 UTC (rev 283078)
@@ -1,3 +1,24 @@
+2021-09-25  Joanmarie Diggs  <[email protected]>
+
+        AX: aria-expanded is no longer supported on quite a few roles in ARIA 1.2
+        https://bugs.webkit.org/show_bug.cgi?id=230609
+
+        Reviewed by Chris Fleizach.
+
+        We were exposing aria-expanded on any element where it was explicitly
+        given a valid value (true/false). We should only expose it on roles where
+        aria-expanded is a supported property. In addition, the number of roles
+        where aria-expanded is a supported property was greatly reduced in ARIA 1.2.
+        This commit brings us in alignment with the spec.
+
+        Test: accessibility/aria-expanded-supported-roles.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::supportsExpanded const):
+        (WebCore::AccessibilityObject::isExpanded const):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):
+
 2021-09-24  Víctor Manuel Jáquez Leal  <[email protected]>
 
         [GTK] Assertion on gamepad in debug build

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (283077 => 283078)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-09-25 08:07:19 UTC (rev 283078)
@@ -2704,15 +2704,29 @@
     
 bool AccessibilityObject::supportsExpanded() const
 {
-    // Undefined values should not result in this attribute being exposed to ATs according to ARIA.
-    const AtomString& expanded = getAttribute(aria_expandedAttr);
-    if (equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false"))
-        return true;
     switch (roleValue()) {
+    case AccessibilityRole::Button:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ColumnHeader:
     case AccessibilityRole::ComboBox:
+    case AccessibilityRole::Details:
     case AccessibilityRole::DisclosureTriangle:
-    case AccessibilityRole::Details:
-        return true;
+    case AccessibilityRole::GridCell:
+    case AccessibilityRole::Link:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::Row:
+    case AccessibilityRole::RowHeader:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::TreeItem:
+    case AccessibilityRole::WebApplication: {
+        // Undefined values should not result in this attribute being exposed to ATs according to ARIA.
+        const AtomString& expanded = getAttribute(aria_expandedAttr);
+        return equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false");
+    }
     default:
         return false;
     }
@@ -2720,9 +2734,6 @@
     
 bool AccessibilityObject::isExpanded() const
 {
-    if (equalLettersIgnoringASCIICase(getAttribute(aria_expandedAttr), "true"))
-        return true;
-    
     if (is<HTMLDetailsElement>(node()))
         return downcast<HTMLDetailsElement>(node())->isOpen();
     
@@ -2734,6 +2745,9 @@
             return parent->isExpanded();
     }
 
+    if (supportsExpanded())
+        return equalLettersIgnoringASCIICase(getAttribute(aria_expandedAttr), "true");
+
     return false;  
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (283077 => 283078)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-09-25 07:45:54 UTC (rev 283077)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-09-25 08:07:19 UTC (rev 283078)
@@ -3239,12 +3239,8 @@
 {
     if (roleValue() == AccessibilityRole::Details)
         return true;
-    
-    // An object can be expanded if it aria-expanded is true or false.
-    const AtomString& expanded = getAttribute(aria_expandedAttr);
-    if (equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false"))
-        return true;
-    return false;
+
+    return supportsExpanded();
 }
 
 bool AccessibilityRenderObject::canSetTextRangeAttributes() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to