Title: [207035] trunk
Revision
207035
Author
n_w...@apple.com
Date
2016-10-10 17:11:40 -0700 (Mon, 10 Oct 2016)

Log Message

AX: Expose invalid status for input types with that information
https://bugs.webkit.org/show_bug.cgi?id=163252
<rdar://problem/28704409>

Reviewed by Chris Fleizach.

Source/WebCore:

For input types with invalid input value, we should expose the invalid
status to the assitive technology.

Test: accessibility/mac/invalid-status-for-input-types.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::invalidStatus):

LayoutTests:

* accessibility/mac/invalid-status-for-input-types-expected.txt: Added.
* accessibility/mac/invalid-status-for-input-types.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207034 => 207035)


--- trunk/LayoutTests/ChangeLog	2016-10-10 23:59:46 UTC (rev 207034)
+++ trunk/LayoutTests/ChangeLog	2016-10-11 00:11:40 UTC (rev 207035)
@@ -1,3 +1,14 @@
+2016-10-10  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose invalid status for input types with that information
+        https://bugs.webkit.org/show_bug.cgi?id=163252
+        <rdar://problem/28704409>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/invalid-status-for-input-types-expected.txt: Added.
+        * accessibility/mac/invalid-status-for-input-types.html: Added.
+
 2016-10-10  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking two media/modern-media-controls tests as failing.

Added: trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt (0 => 207035)


--- trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types-expected.txt	2016-10-11 00:11:40 UTC (rev 207035)
@@ -0,0 +1,13 @@
+         
+This tests that we are exposing correct invalid status for different types.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS: AXInvalid is true.
+PASS: AXInvalid is false.
+PASS: AXInvalid is true.
+PASS: AXInvalid is false.
+PASS: AXInvalid is true.
+PASS: AXInvalid is false.
+

Added: trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html (0 => 207035)


--- trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/invalid-status-for-input-types.html	2016-10-11 00:11:40 UTC (rev 207035)
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="examples">
+    <input class="ex" data-expected="true" type="number" value="abc">
+    <input class="ex" data-expected="false" type="number" value="10">
+    
+    <input class="ex" data-expected="true" type="url" value="abc">
+    <input class="ex" data-expected="false" type="url" value="http://abc.com">
+    
+    <input class="ex" data-expected="true" type="email" value="abc">
+    <input class="ex" data-expected="false" type="email" value="a...@abc.com">
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that we are exposing correct invalid status for different types.");
+
+    function $(id){
+        return document.getElementById(id);
+    }
+
+    var result = $('console');
+    function verify(value, expectation, element) {
+      if (value === expectation)
+        result.innerText += "PASS: AXInvalid is " + value + ".\n";
+      else
+        result.innerText += "FAIL: AXInvalid is " + value + ". Expected: " + expectation + ". " + (element ? element.outerHTML : "") + "\n";
+    }
+
+    if (window.accessibilityController) {
+
+        var examples = document.querySelectorAll(".ex");
+        for (var i = 0, c = examples.length; i < c; i++) {
+            var el = examples[i];
+            el.focus();
+            if (i == 0)
+                eventSender.keyDown('a');
+            var expectation = el.getAttribute("data-expected");
+            var value = accessibilityController.focusedElement.stringAttributeValue('AXInvalid');
+            verify(value, expectation, el);
+        }
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (207034 => 207035)


--- trunk/Source/WebCore/ChangeLog	2016-10-10 23:59:46 UTC (rev 207034)
+++ trunk/Source/WebCore/ChangeLog	2016-10-11 00:11:40 UTC (rev 207035)
@@ -1,3 +1,19 @@
+2016-10-10  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose invalid status for input types with that information
+        https://bugs.webkit.org/show_bug.cgi?id=163252
+        <rdar://problem/28704409>
+
+        Reviewed by Chris Fleizach.
+
+        For input types with invalid input value, we should expose the invalid 
+        status to the assitive technology.
+
+        Test: accessibility/mac/invalid-status-for-input-types.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::invalidStatus):
+
 2016-10-10  Konstantin Tokarev  <annu...@yandex.ru>
 
         Added override specifier to PluginViewBase::isPluginViewBase()

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (207034 => 207035)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-10-10 23:59:46 UTC (rev 207034)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-10-11 00:11:40 UTC (rev 207035)
@@ -1909,8 +1909,19 @@
     // aria-invalid can return false (default), grammar, spelling, or true.
     String ariaInvalid = stripLeadingAndTrailingHTMLSpaces(getAttribute(aria_invalidAttr));
     
+    if (ariaInvalid.isEmpty()) {
+        // We should expose invalid status for input types.
+        Node* node = this->node();
+        if (node && is<HTMLInputElement>(*node)) {
+            HTMLInputElement& input = downcast<HTMLInputElement>(*node);
+            if (input.hasBadInput() || input.typeMismatch())
+                return trueValue;
+        }
+        return falseValue;
+    }
+    
     // If "false", "undefined" [sic, string value], empty, or missing, return "false".
-    if (ariaInvalid.isEmpty() || ariaInvalid == falseValue || ariaInvalid == undefinedValue)
+    if (ariaInvalid == falseValue || ariaInvalid == undefinedValue)
         return falseValue;
     // Besides true/false/undefined, the only tokens defined by WAI-ARIA 1.0...
     // ...for @aria-invalid are "grammar" and "spelling".
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to