AX: file upload input text value is not exposed through accessibility
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 20:30:10 +0000 (20:30 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 20:30:10 +0000 (20:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100583

Reviewed by Beth Dakin.

Source/WebCore:

This is a hard problem to solve on the Mac because there are three pieces of information
     1) The type of button 2) The text on the button 3) The text for the value.
I think the best compromise is to label this as a file upload button type in the role description,
and then expose the file path text as the AXTitle.
This will give the more relevant information and should be clear what is happening.

Test: platform/mac/accessibility/file-upload-button-subrole.html

* English.lproj/Localizable.strings:
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(-[WebAccessibilityObjectWrapper subrole]):
(-[WebAccessibilityObjectWrapper roleDescription]):
(-[WebAccessibilityObjectWrapper accessibilityTitle]):
* platform/LocalizedStrings.cpp:
(WebCore::AXFileUploadButtonText):
* platform/LocalizedStrings.h:

LayoutTests:

* platform/mac/accessibility/file-upload-button-subrole-expected.txt: Added.
* platform/mac/accessibility/file-upload-button-subrole.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h

index e60d319..a5e6f0b 100644 (file)
@@ -1,3 +1,13 @@
+2012-11-13  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: file upload input text value is not exposed through accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=100583
+
+        Reviewed by Beth Dakin.
+
+        * platform/mac/accessibility/file-upload-button-subrole-expected.txt: Added.
+        * platform/mac/accessibility/file-upload-button-subrole.html: Added.
+
 2012-11-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r133944.
 2012-11-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r133944.
diff --git a/LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt b/LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt
new file mode 100644 (file)
index 0000000..ab834b2
--- /dev/null
@@ -0,0 +1,13 @@
+
+This tests that a file upload button will have a specific subrole and a title that matches the files selected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS uploadButton.subrole is 'AXSubrole: AXFileUploadButton'
+PASS uploadButton.roleDescription is 'AXRoleDescription: file upload button'
+PASS uploadButton.title is 'AXTitle: no file selected'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html b/LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html
new file mode 100644 (file)
index 0000000..3873e93
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="file" id="fileupload">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that a file upload button will have a specific subrole and a title that matches the files selected.");
+
+    if (window.accessibilityController) {
+
+          var uploadButton = accessibilityController.accessibleElementById("fileupload");
+          shouldBe("uploadButton.subrole", "'AXSubrole: AXFileUploadButton'");
+          shouldBe("uploadButton.roleDescription", "'AXRoleDescription: file upload button'");
+          shouldBe("uploadButton.title", "'AXTitle: no file selected'");
+    }
+
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 4744a95..0c08a06 100644 (file)
@@ -1,3 +1,27 @@
+2012-11-13  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: file upload input text value is not exposed through accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=100583
+
+        Reviewed by Beth Dakin.
+
+        This is a hard problem to solve on the Mac because there are three pieces of information
+             1) The type of button 2) The text on the button 3) The text for the value.
+        I think the best compromise is to label this as a file upload button type in the role description, 
+        and then expose the file path text as the AXTitle. 
+        This will give the more relevant information and should be clear what is happening.
+
+        Test: platform/mac/accessibility/file-upload-button-subrole.html
+
+        * English.lproj/Localizable.strings:
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (-[WebAccessibilityObjectWrapper subrole]):
+        (-[WebAccessibilityObjectWrapper roleDescription]):
+        (-[WebAccessibilityObjectWrapper accessibilityTitle]):
+        * platform/LocalizedStrings.cpp:
+        (WebCore::AXFileUploadButtonText):
+        * platform/LocalizedStrings.h:
+
 2012-11-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r133944.
 2012-11-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r133944.
index 56c65b0..a0a8766 100644 (file)
Binary files a/Source/WebCore/English.lproj/Localizable.strings and b/Source/WebCore/English.lproj/Localizable.strings differ
index 384acf0..6c9ce74 100644 (file)
@@ -1649,6 +1649,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return NSAccessibilityDecrementArrowSubrole;
     }
     
         return NSAccessibilityDecrementArrowSubrole;
     }
     
+    if (m_object->isFileUploadButton())
+        return @"AXFileUploadButton";
+    
     if (m_object->isTreeItem())
         return NSAccessibilityOutlineRowSubrole;
     
     if (m_object->isTreeItem())
         return NSAccessibilityOutlineRowSubrole;
     
@@ -1802,6 +1805,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if ([axRole isEqualToString:@"AXHeading"])
         return AXHeadingText();
 
     if ([axRole isEqualToString:@"AXHeading"])
         return AXHeadingText();
 
+    if (m_object->isFileUploadButton())
+        return AXFileUploadButtonText();
+    
     // AppKit also returns AXTab for the role description for a tab item.
     if (m_object->isTabItem())
         return NSAccessibilityRoleDescription(@"AXTab", nil);
     // AppKit also returns AXTab for the role description for a tab item.
     if (m_object->isTabItem())
         return NSAccessibilityRoleDescription(@"AXTab", nil);
@@ -1852,6 +1858,12 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if (m_object->roleValue() == StaticTextRole)
         return [NSString string];
 
     if (m_object->roleValue() == StaticTextRole)
         return [NSString string];
 
+    // A file upload button presents a challenge because it has button text and a value, but the
+    // API doesn't support this paradigm.
+    // The compromise is to return the button type in the role description and the value of the file path in the title
+    if (m_object->isFileUploadButton())
+        return m_object->stringValue();
+    
     Vector<AccessibilityText> textOrder;
     m_object->accessibilityText(textOrder);
     
     Vector<AccessibilityText> textOrder;
     m_object->accessibilityText(textOrder);
     
index 8f7866f..0277223 100644 (file)
@@ -571,6 +571,11 @@ String AXFooterRoleDescriptionText()
 {
     return WEB_UI_STRING("footer", "accessibility role description for a footer");
 }
 {
     return WEB_UI_STRING("footer", "accessibility role description for a footer");
 }
+    
+String AXFileUploadButtonText()
+{
+    return WEB_UI_STRING("file upload", "accessibility role description for a file upload button");
+}
 
 #if PLATFORM(MAC)
 String AXARIAContentGroupText(const String& ariaType)
 
 #if PLATFORM(MAC)
 String AXARIAContentGroupText(const String& ariaType)
index bcd22c4..6732748 100644 (file)
@@ -155,6 +155,7 @@ namespace WebCore {
     String AXDefinitionListTermText();
     String AXDefinitionListDefinitionText();
     String AXFooterRoleDescriptionText();
     String AXDefinitionListTermText();
     String AXDefinitionListDefinitionText();
     String AXFooterRoleDescriptionText();
+    String AXFileUploadButtonText();
 #if PLATFORM(MAC)
     String AXARIAContentGroupText(const String& ariaType);
 #endif
 #if PLATFORM(MAC)
     String AXARIAContentGroupText(const String& ariaType);
 #endif