Title: [247295] trunk
Revision
247295
Author
[email protected]
Date
2019-07-09 23:33:57 -0700 (Tue, 09 Jul 2019)

Log Message

AX: HTML datalist accessibility is not exposed by WebKit
https://bugs.webkit.org/show_bug.cgi?id=196998
<rdar://problem/49962521>

Patch by Andres Gonzalez <[email protected]> on 2019-07-09
Reviewed by Chris Fleizach.

Source/WebCore:

Input fields with datalist are exposed as having a listbox popup.

Test: accessibility/datalist.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::popupValue const):
(WebCore::AccessibilityObject::hasDatalist const):
* accessibility/AccessibilityObject.h:

LayoutTests:

* accessibility/datalist-expected.txt: Added.
* accessibility/datalist.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247294 => 247295)


--- trunk/LayoutTests/ChangeLog	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/LayoutTests/ChangeLog	2019-07-10 06:33:57 UTC (rev 247295)
@@ -1,3 +1,14 @@
+2019-07-09  Andres Gonzalez  <[email protected]>
+
+        AX: HTML datalist accessibility is not exposed by WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=196998
+        <rdar://problem/49962521>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/datalist-expected.txt: Added.
+        * accessibility/datalist.html: Added.
+
 2019-07-09  Saam Barati  <[email protected]>
 
         [WHLSL] Import another round of JS spec tests

Added: trunk/LayoutTests/accessibility/datalist-expected.txt (0 => 247295)


--- trunk/LayoutTests/accessibility/datalist-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/datalist-expected.txt	2019-07-10 06:33:57 UTC (rev 247295)
@@ -0,0 +1,13 @@
+Websites 
+
+This tests that an input field with a datalist is conveyed as listbox popup.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axInput.popupValue is 'listbox'
+PASS axInput.popupValue is 'listbox'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/datalist.html (0 => 247295)


--- trunk/LayoutTests/accessibility/datalist.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/datalist.html	2019-07-10 06:33:57 UTC (rev 247295)
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<div>
+    <label>
+        Websites <input id="input1" type="text" list="datalist1" />
+    </label>
+    <datalist id="datalist1">
+        <option value="https://www.apple.com/" label="Apple">Apple</option>
+        <option value="https://www.wikipedia.com/" label="Wikipedia">Wikipedia</option>
+    </datalist>
+</div>
+
+<div>
+    <input id="input2" type="search" placeholder="Fruits" list="fruits" />
+    <datalist id="fruits">
+        <select>
+            <option>Apple</option>
+            <option>Apricot</option>
+            <option>Banana</option>
+            <option>Cantaloupe</option>
+            <option>Durian</option>
+            <option>Grape</option>
+            <option>Guava</option>
+            <option>Orange</option>
+            <option>Mango</option>
+            <option>Pear</option>
+            <option>Watermelon</option>
+            <option></option>
+            <option disabled>Foo</option>
+        </select>
+    </datalist>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that an input field with a datalist is conveyed as listbox popup.");
+
+    if (window.accessibilityController) {
+        document.getElementById("input1").focus();
+        var axInput = accessibilityController.focusedElement;
+        shouldBe("axInput.popupValue", "'listbox'");
+
+        document.getElementById("input2").focus();
+        axInput = accessibilityController.focusedElement;
+        shouldBe("axInput.popupValue", "'listbox'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (247294 => 247295)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2019-07-10 06:33:57 UTC (rev 247295)
@@ -178,6 +178,7 @@
 fast/history/page-cache-notification-suspendable.html
 
 # Datalist is not yet enabled.
+accessibility/datalist.html [ Skip ]
 webkit.org/b/98934 fast/forms/datalist [ Skip ]
 
 # ENABLE_INPUT_TYPE_* are not enabled.

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (247294 => 247295)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2019-07-10 06:33:57 UTC (rev 247295)
@@ -56,6 +56,7 @@
 inspector/page/overrideSetting-MockCaptureDevicesEnabled.html [ Skip ]
 
 # Datalist is unsupported in WK1
+accessibility/datalist.html [ WontFix ]
 fast/forms/datalist [ WontFix ]
 imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-element [ WontFix ]
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (247294 => 247295)


--- trunk/LayoutTests/platform/win/TestExpectations	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/LayoutTests/platform/win/TestExpectations	2019-07-10 06:33:57 UTC (rev 247295)
@@ -550,6 +550,7 @@
 http/tests/pointer-lock/ [ Skip ]
 
 # Datalist is unsupported on Windows
+accessibility/datalist.html [ WontFix ]
 fast/forms/datalist [ WontFix ]
 imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-element [ WontFix ]
 

Modified: trunk/Source/WebCore/ChangeLog (247294 => 247295)


--- trunk/Source/WebCore/ChangeLog	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/Source/WebCore/ChangeLog	2019-07-10 06:33:57 UTC (rev 247295)
@@ -1,3 +1,20 @@
+2019-07-09  Andres Gonzalez  <[email protected]>
+
+        AX: HTML datalist accessibility is not exposed by WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=196998
+        <rdar://problem/49962521>
+
+        Reviewed by Chris Fleizach.
+
+        Input fields with datalist are exposed as having a listbox popup.
+
+        Test: accessibility/datalist.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::popupValue const):
+        (WebCore::AccessibilityObject::hasDatalist const):
+        * accessibility/AccessibilityObject.h:
+
 2019-07-09  Justin Fan  <[email protected]>
 
         Replace old, broken WebGPU IDL spec link with the new one in IDL comments.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (247294 => 247295)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-07-10 06:33:57 UTC (rev 247295)
@@ -48,6 +48,7 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameSelection.h"
+#include "HTMLDataListElement.h"
 #include "HTMLDetailsElement.h"
 #include "HTMLFormControlElement.h"
 #include "HTMLInputElement.h"
@@ -2767,7 +2768,7 @@
     auto hasPopup = getAttribute(aria_haspopupAttr).convertToASCIILowercase();
     if (hasPopup.isNull() || hasPopup.isEmpty()) {
         // In ARIA 1.1, the implicit value for combobox became "listbox."
-        if (isComboBox())
+        if (isComboBox() || hasDatalist())
             return "listbox";
         return "false";
     }
@@ -2785,6 +2786,24 @@
     return "false";
 }
 
+bool AccessibilityObject::hasDatalist() const
+{
+#if ENABLE(DATALIST_ELEMENT)
+    auto datalistId = getAttribute(listAttr);
+    if (datalistId.isNull() || datalistId.isEmpty())
+        return false;
+
+    auto element = this->element();
+    if (!element)
+        return false;
+
+    auto datalist = element->treeScope().getElementById(datalistId);
+    return is<HTMLDataListElement>(datalist);
+#else
+    return false;
+#endif
+}
+
 bool AccessibilityObject::supportsSetSize() const
 {
     return hasAttribute(aria_setsizeAttr);

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (247294 => 247295)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2019-07-10 06:02:33 UTC (rev 247294)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2019-07-10 06:33:57 UTC (rev 247295)
@@ -553,6 +553,7 @@
 
     virtual bool hasPopup() const { return false; }
     String popupValue() const;
+    bool hasDatalist() const;
     bool supportsHasPopup() const;
     bool pressedIsPresent() const;
     bool ariaIsMultiline() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to