AX: AutoFill button is not accessible with VoiceOver
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 17:58:37 +0000 (17:58 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 17:58:37 +0000 (17:58 +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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184645 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]
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 bb892b1..9e0e61c 100644 (file)
@@ -1,3 +1,16 @@
+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.
+
 2015-05-20  Joseph Pecoraro  <pecoraro@apple.com>
 
         ES6: Implement Object.setPrototypeOf
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 4ac8979..e6c01f9 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  Alex Christensen  <achristensen@webkit.org>
 
         [Content Extensions] Relax restrictions on triggers that match everything.
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..57f49c5 100644 (file)
@@ -604,6 +604,11 @@ String AXSearchFieldCancelButtonText()
     return WEB_UI_STRING("cancel", "accessibility description for a search field cancel button");
 }
 
+String AXAutoFillButtonText()
+{
+    return WEB_UI_STRING("autofill", "accessibility description for a password field AutoFill button");
+}
+
 String AXButtonActionVerb()
 {
     return WEB_UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
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"));