Commit 61418623 authored by Daniel Clark's avatar Daniel Clark Committed by Commit Bot

Make <input type='url'> have UIA LocalizedControlType == 'url'

An <input type='url'> should have LocalizedControlType of "url"
per https://w3c.github.io/html-aam/#el-input-url

Currently its LocalizedControlType is "edit".  This change updates it
to the correct value by adding an entry to
BrowserAccessibility::GetLocalizedStringForRoleDescription().

Bug: 990386
Change-Id: I92cee38c5fb0b9c81229cb6070784271187f4154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733202Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#685236}
parent 3fc9f70f
...@@ -470,6 +470,10 @@ below: ...@@ -470,6 +470,10 @@ below:
<message name="IDS_AX_ROLE_TELEPHONE" desc="Accessibility role description for telephone number input"> <message name="IDS_AX_ROLE_TELEPHONE" desc="Accessibility role description for telephone number input">
telephone telephone
</message> </message>
<!-- https://w3c.github.io/html-aam/#el-input-url -->
<message name="IDS_AX_ROLE_URL" desc="Accessibility role description for URL input">
url
</message>
<message name="IDS_AX_ROLE_WEB_AREA" desc="Accessibility role description for web area"> <message name="IDS_AX_ROLE_WEB_AREA" desc="Accessibility role description for web area">
HTML content HTML content
</message> </message>
......
...@@ -1855,9 +1855,12 @@ base::string16 BrowserAccessibility::GetLocalizedStringForRoleDescription() ...@@ -1855,9 +1855,12 @@ base::string16 BrowserAccessibility::GetLocalizedStringForRoleDescription()
case ax::mojom::Role::kTextField: { case ax::mojom::Role::kTextField: {
std::string input_type; std::string input_type;
if (data.GetStringAttribute(ax::mojom::StringAttribute::kInputType, if (data.GetStringAttribute(ax::mojom::StringAttribute::kInputType,
&input_type) && &input_type)) {
input_type == "tel") { if (input_type == "tel") {
return content_client->GetLocalizedString(IDS_AX_ROLE_TELEPHONE); return content_client->GetLocalizedString(IDS_AX_ROLE_TELEPHONE);
} else if (input_type == "url") {
return content_client->GetLocalizedString(IDS_AX_ROLE_URL);
}
} }
return {}; return {};
} }
......
...@@ -707,7 +707,8 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, ...@@ -707,7 +707,8 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
GURL url( GURL url(
"data:text/html," "data:text/html,"
"<input>" "<input>"
"<input type='tel'>"); "<input type='tel'>"
"<input type='url'>");
NavigateToURL(shell(), url); NavigateToURL(shell(), url);
waiter.WaitForNotification(); waiter.WaitForNotification();
...@@ -717,7 +718,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, ...@@ -717,7 +718,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
ASSERT_EQ(1u, root->PlatformChildCount()); ASSERT_EQ(1u, root->PlatformChildCount());
BrowserAccessibility* body = root->PlatformGetChild(0); BrowserAccessibility* body = root->PlatformGetChild(0);
ASSERT_EQ(2u, body->PlatformChildCount()); ASSERT_EQ(3u, body->PlatformChildCount());
auto TestLocalizedRoleDescription = auto TestLocalizedRoleDescription =
[body](int child_index, [body](int child_index,
...@@ -732,6 +733,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, ...@@ -732,6 +733,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
// For testing purposes, assume we get en-US localized strings. // For testing purposes, assume we get en-US localized strings.
TestLocalizedRoleDescription(0, base::ASCIIToUTF16("")); TestLocalizedRoleDescription(0, base::ASCIIToUTF16(""));
TestLocalizedRoleDescription(1, base::ASCIIToUTF16("telephone")); TestLocalizedRoleDescription(1, base::ASCIIToUTF16("telephone"));
TestLocalizedRoleDescription(2, base::ASCIIToUTF16("url"));
} }
IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
......
document document LocalizedControlType='document'
++group ++group LocalizedControlType='group'
++++textbox Value.Value='example.com' ++++textbox LocalizedControlType='url' Value.Value='example.com'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0 ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0 ++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
++++ROLE_SYSTEM_TEXT value='example.com' FOCUSABLE IA2_STATE_INVALID_ENTRY text-input-type:url ia2_hypertext='example.com' caret_offset=0 n_selections=0 ++++ROLE_SYSTEM_TEXT value='example.com' FOCUSABLE IA2_STATE_INVALID_ENTRY text-input-type:url ia2_hypertext='example.com' caret_offset=0 n_selections=0 localized_extended_role='url'
<!-- <!--
@BLINK-ALLOW:inputType=*
@UIA-WIN-ALLOW:LocalizedControlType=*
@MAC-ALLOW:AXRole* @MAC-ALLOW:AXRole*
@WIN-ALLOW:caret_offset* @WIN-ALLOW:caret_offset*
@WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:ia2_hypertext=*
@WIN-ALLOW:localized_extended_role=*
@WIN-ALLOW:n_selections* @WIN-ALLOW:n_selections*
@WIN-ALLOW:selection_start* @WIN-ALLOW:selection_start*
@WIN-ALLOW:selection_end* @WIN-ALLOW:selection_end*
......
...@@ -561,9 +561,12 @@ base::string16 TestAXNodeWrapper::GetLocalizedStringForRoleDescription() const { ...@@ -561,9 +561,12 @@ base::string16 TestAXNodeWrapper::GetLocalizedStringForRoleDescription() const {
case ax::mojom::Role::kTextField: { case ax::mojom::Role::kTextField: {
std::string input_type; std::string input_type;
if (data.GetStringAttribute(ax::mojom::StringAttribute::kInputType, if (data.GetStringAttribute(ax::mojom::StringAttribute::kInputType,
&input_type) && &input_type)) {
input_type == "tel") { if (input_type == "tel") {
return base::ASCIIToUTF16("telephone"); return base::ASCIIToUTF16("telephone");
} else if (input_type == "url") {
return base::ASCIIToUTF16("url");
}
} }
return {}; return {};
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment