AX: AutoFill button is not accessible with VoiceOver
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 21:38:01 +0000 (21:38 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 21:38:01 +0000 (21:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145200
<rdar://problem/20507480>

Reviewed by Chris Fleizach.

Source/WebCore:

Add ARIA label and role attributes to the AutoFill button markup so that VoiceOver
can identify and interact with it.

Test: accessibility/input-auto-fill-button.html

* English.lproj/Localizable.strings: Add placeholder localized string for AutoFill button.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createAutoFillButton): Add ARIA label and role attributes.
* platform/LocalizedStrings.cpp:
(WebCore::AXAutoFillButtonText): Added; returns the localized string for the AutoFill button.
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::AXAutoFillButtonText): Ditto.
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::AXAutoFillButtonText): Ditto.

LayoutTests:

Test that there is an accessibility element for the AutoFill button.

* accessibility/input-auto-fill-button-expected.txt: Added.
* accessibility/input-auto-fill-button.html: Added.
* platform/win/TestExpectations: For now, mark tests as failing. I suspect the cause
is <https://bugs.webkit.org/show_bug.cgi?id=140798>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184660 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/input-auto-fill-button-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/input-auto-fill-button.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/platform/efl/LocalizedStringsEfl.cpp
Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp

index 0c4a102..e5fcfe2 100644 (file)
@@ -1,3 +1,18 @@
+2015-05-20  Daniel Bates  <dabates@apple.com>
+
+        AX: AutoFill button is not accessible with VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=145200
+        <rdar://problem/20507480>
+
+        Reviewed by Chris Fleizach.
+
+        Test that there is an accessibility element for the AutoFill button.
+
+        * accessibility/input-auto-fill-button-expected.txt: Added.
+        * accessibility/input-auto-fill-button.html: Added.
+        * platform/win/TestExpectations: For now, mark tests as failing. I suspect the cause
+        is <https://bugs.webkit.org/show_bug.cgi?id=140798>.
+
 2015-05-20  Antti Koivisto  <antti@apple.com>
 
         Assertion failure in WebCore::BidiRun::BidiRun()
diff --git a/LayoutTests/accessibility/input-auto-fill-button-expected.txt b/LayoutTests/accessibility/input-auto-fill-button-expected.txt
new file mode 100644 (file)
index 0000000..48c5d3a
--- /dev/null
@@ -0,0 +1,11 @@
+This tests that there exists an accessibility element for the AutoFill button.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.accessibleElementById("password").childAtIndex(0).description is "AXDescription: autofill"
+PASS accessibilityController.accessibleElementById("password").childAtIndex(0).role is "AXRole: AXButton"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/input-auto-fill-button.html b/LayoutTests/accessibility/input-auto-fill-button.html
new file mode 100644 (file)
index 0000000..436a722
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+<input type="password" id="password">
+<script>
+description("This tests that there exists an accessibility element for the AutoFill button.");
+
+if (!window.internals || !window.accessibilityController)
+    testFailed("You must run this test in the test tool and have implemented window.internals and window.accessibilityController.");
+else {
+    internals.setShowAutoFillButton(document.getElementById("password"), true);
+
+    shouldBeEqualToString('accessibilityController.accessibleElementById("password").childAtIndex(0).description', "AXDescription: autofill");
+    shouldBeEqualToString('accessibilityController.accessibleElementById("password").childAtIndex(0).role', "AXRole: AXButton");
+}
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index 6b95fa2..3e507e0 100644 (file)
@@ -1322,6 +1322,8 @@ webkit.org/b/140798 [ Release ] accessibility/html-html-element-is-ignored.html
 webkit.org/b/140798 [ Debug ] accessibility/html-html-element-is-ignored.html [ Skip ] # Debug assertion
 webkit.org/b/140798 [ Release ] accessibility/inline-block-assertion.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/inline-block-assertion.html [ Skip ] # Debug assertion
+webkit.org/b/140798 [ Release ] accessibility/input-auto-fill-button.html [ Failure ]
+webkit.org/b/140798 [ Debug ] accessibility/input-auto-fill-button.html [ Failure ]
 webkit.org/b/140798 [ Release ] accessibility/input-type-hidden-in-aria-hidden-false.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/input-type-hidden-in-aria-hidden-false.html [ Skip ] # Debug assertion
 webkit.org/b/140798 [ Release ] accessibility/legend-children-are-visible.html [ Failure ]
index 997f05d..81c2eb4 100644 (file)
@@ -1,3 +1,27 @@
+2015-05-20  Daniel Bates  <dabates@apple.com>
+
+        AX: AutoFill button is not accessible with VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=145200
+        <rdar://problem/20507480>
+
+        Reviewed by Chris Fleizach.
+
+        Add ARIA label and role attributes to the AutoFill button markup so that VoiceOver
+        can identify and interact with it.
+
+        Test: accessibility/input-auto-fill-button.html
+
+        * English.lproj/Localizable.strings: Add placeholder localized string for AutoFill button.
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::createAutoFillButton): Add ARIA label and role attributes.
+        * platform/LocalizedStrings.cpp:
+        (WebCore::AXAutoFillButtonText): Added; returns the localized string for the AutoFill button.
+        * platform/LocalizedStrings.h:
+        * platform/efl/LocalizedStringsEfl.cpp:
+        (WebCore::AXAutoFillButtonText): Ditto.
+        * platform/gtk/LocalizedStringsGtk.cpp:
+        (WebCore::AXAutoFillButtonText): Ditto.
+
 2015-05-20  Dean Jackson  <dino@apple.com>
 
         Label text for default buttons don’t have the correct white color
index 9da8c7d..0281142 100644 (file)
 /* accessibility description for a search field cancel button */
 "cancel" = "cancel";
 
+/* accessibility description for a password field AutoFill button */
+"autofill" = "autofill";
+
 /* Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility */
 "check" = "check";
 
index cbd48d9..6c71ae7 100644 (file)
@@ -42,6 +42,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "KeyboardEvent.h"
+#include "LocalizedStrings.h"
 #include "NodeRenderStyle.h"
 #include "Page.h"
 #include "PlatformKeyboardEvent.h"
@@ -602,6 +603,8 @@ void TextFieldInputType::createAutoFillButton()
 
     m_autoFillButton = AutoFillButtonElement::create(element().document(), *this);
     m_autoFillButton->setPseudo(AtomicString("-webkit-auto-fill-button", AtomicString::ConstructFromLiteral));
+    m_autoFillButton->setAttribute(aria_labelAttr, AtomicString(AXAutoFillButtonText()));
+    m_autoFillButton->setAttribute(roleAttr, AtomicString("button", AtomicString::ConstructFromLiteral));
     m_container->appendChild(m_autoFillButton, IGNORE_EXCEPTION);
 }
 
index 93d2e90..a1dedb5 100644 (file)
@@ -653,6 +653,11 @@ String AXListItemActionVerb()
 }
 #endif // !PLATFORM(IOS)
 
+String AXAutoFillButtonText()
+{
+    return WEB_UI_STRING("autofill", "accessibility description for a password field AutoFill button");
+}
+
 #if PLATFORM(COCOA)
 String AXARIAContentGroupText(const String& ariaType)
 {
index 09a3800..4f71481 100644 (file)
@@ -162,7 +162,7 @@ namespace WebCore {
     String AXFooterRoleDescriptionText();
     String AXFileUploadButtonText();
     String AXSearchFieldCancelButtonText();
-    
+
     String AXButtonActionVerb();
     String AXRadioButtonActionVerb();
     String AXTextFieldActionVerb();
@@ -174,6 +174,8 @@ namespace WebCore {
     String AXListItemActionVerb();
 #endif
 
+    String AXAutoFillButtonText();
+
 #if ENABLE(INPUT_TYPE_WEEK)
     // weekFormatInLDML() returns week and year format in LDML, Unicode
     // technical standard 35, Locale Data Markup Language, e.g. "'Week' ww, yyyy"
index 3ea96d7..79009bf 100644 (file)
@@ -408,6 +408,11 @@ String AXSearchFieldCancelButtonText()
     return String::fromUTF8("cancel");
 }
 
+String AXAutoFillButtonText()
+{
+    return String::fromUTF8("autofill");
+}
+
 String AXButtonActionVerb()
 {
     return String::fromUTF8("press");
index 412087b..464c947 100644 (file)
@@ -456,6 +456,11 @@ String AXSearchFieldCancelButtonText()
     return String::fromUTF8(_("cancel"));
 }
 
+String AXAutoFillButtonText()
+{
+    return String::fromUTF8(_("autofill"));
+}
+
 String AXButtonActionVerb()
 {
     return String::fromUTF8(_("press"));