Title: [134465] trunk
Revision
134465
Author
[email protected]
Date
2012-11-13 12:30:10 -0800 (Tue, 13 Nov 2012)

Log Message

AX: file upload input text value is not exposed through accessibility
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134464 => 134465)


--- trunk/LayoutTests/ChangeLog	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/LayoutTests/ChangeLog	2012-11-13 20:30:10 UTC (rev 134465)
@@ -1,3 +1,13 @@
+2012-11-13  Chris Fleizach  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed, rolling out r133944.

Added: trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt (0 => 134465)


--- trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole-expected.txt	2012-11-13 20:30:10 UTC (rev 134465)
@@ -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
+

Added: trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html (0 => 134465)


--- trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/file-upload-button-subrole.html	2012-11-13 20:30:10 UTC (rev 134465)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</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=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134464 => 134465)


--- trunk/Source/WebCore/ChangeLog	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/Source/WebCore/ChangeLog	2012-11-13 20:30:10 UTC (rev 134465)
@@ -1,3 +1,27 @@
+2012-11-13  Chris Fleizach  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed, rolling out r133944.

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (134464 => 134465)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2012-11-13 20:30:10 UTC (rev 134465)
@@ -616,6 +616,9 @@
 /* accessibility role description for fast reverse button */
 "fast reverse" = "fast reverse";
 
+/* accessibility role description for a file upload button */
+"file upload" = "file upload button";
+
 /* accessibility role description for a footer */
 "footer" = "footer";
 

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (134464 => 134465)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-11-13 20:30:10 UTC (rev 134465)
@@ -1649,6 +1649,9 @@
         return NSAccessibilityDecrementArrowSubrole;
     }
     
+    if (m_object->isFileUploadButton())
+        return @"AXFileUploadButton";
+    
     if (m_object->isTreeItem())
         return NSAccessibilityOutlineRowSubrole;
     
@@ -1802,6 +1805,9 @@
     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);
@@ -1852,6 +1858,12 @@
     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);
     

Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (134464 => 134465)


--- trunk/Source/WebCore/platform/LocalizedStrings.cpp	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp	2012-11-13 20:30:10 UTC (rev 134465)
@@ -571,6 +571,11 @@
 {
     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)

Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (134464 => 134465)


--- trunk/Source/WebCore/platform/LocalizedStrings.h	2012-11-13 20:17:55 UTC (rev 134464)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h	2012-11-13 20:30:10 UTC (rev 134465)
@@ -155,6 +155,7 @@
     String AXDefinitionListTermText();
     String AXDefinitionListDefinitionText();
     String AXFooterRoleDescriptionText();
+    String AXFileUploadButtonText();
 #if PLATFORM(MAC)
     String AXARIAContentGroupText(const String& ariaType);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to