Skip to content

Commit

Permalink
Change LocalizedControlType of <details> to 'details'
Browse files Browse the repository at this point in the history
Change the LocalizedControlType of <details> to "details" per
https://w3c.github.io/html-aam/#el-details

Bug: 992241
Change-Id: Ia5fc7a9cc7fca8f8c3cb00597bc00792bfdd8e04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1745806
Commit-Queue: Dan Clark <daniec@microsoft.com>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#685819}
  • Loading branch information
dandclark authored and Commit Bot committed Aug 10, 2019
1 parent d4bf24d commit df842c7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
4 changes: 4 additions & 0 deletions content/app/strings/content_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ below:
<message name="IDS_AX_ROLE_DESCRIPTION_TERM" desc="Accessibility role description for description term (as in a description list)">
term
</message>
<!-- https://w3c.github.io/html-aam/#el-details -->
<message name="IDS_AX_ROLE_DETAILS" desc="Accessibility role description for details">
details
</message>
<message name="IDS_AX_ROLE_DISCLOSURE_TRIANGLE" desc="Accessibility role description for a disclosure triangle, a control shaped like a triangle that expands or collapses to show or hide extra content">
disclosure triangle
</message>
Expand Down
3 changes: 3 additions & 0 deletions content/browser/accessibility/browser_accessibility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,9 @@ base::string16 BrowserAccessibility::GetLocalizedStringForRoleDescription()
case ax::mojom::Role::kAudio:
return content_client->GetLocalizedString(IDS_AX_ROLE_AUDIO);

case ax::mojom::Role::kDetails:
return content_client->GetLocalizedString(IDS_AX_ROLE_DETAILS);

case ax::mojom::Role::kMeter:
return content_client->GetLocalizedString(IDS_AX_ROLE_METER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
GURL url(
"data:text/html,"
"<audio controls></audio>"
"<details></details>"
"<input>"
"<input type='email'>"
"<input type='tel'>"
Expand All @@ -718,15 +719,12 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,

BrowserAccessibility* root = GetManager()->GetRoot();
ASSERT_NE(nullptr, root);
ASSERT_EQ(1u, root->PlatformChildCount());

BrowserAccessibility* body = root->PlatformGetChild(0);
ASSERT_EQ(6u, body->PlatformChildCount());
ASSERT_EQ(7u, root->PlatformChildCount());

auto TestLocalizedRoleDescription =
[body](int child_index,
[root](int child_index,
const base::string16& expected_localized_role_description = {}) {
BrowserAccessibility* node = body->PlatformGetChild(child_index);
BrowserAccessibility* node = root->PlatformGetChild(child_index);
ASSERT_NE(nullptr, node);

EXPECT_EQ(expected_localized_role_description,
Expand All @@ -735,11 +733,12 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,

// For testing purposes, assume we get en-US localized strings.
TestLocalizedRoleDescription(0, base::ASCIIToUTF16("audio"));
TestLocalizedRoleDescription(1, base::ASCIIToUTF16(""));
TestLocalizedRoleDescription(2, base::ASCIIToUTF16("email"));
TestLocalizedRoleDescription(3, base::ASCIIToUTF16("telephone"));
TestLocalizedRoleDescription(4, base::ASCIIToUTF16("url"));
TestLocalizedRoleDescription(5, base::ASCIIToUTF16("meter"));
TestLocalizedRoleDescription(1, base::ASCIIToUTF16("details"));
TestLocalizedRoleDescription(2, base::ASCIIToUTF16(""));
TestLocalizedRoleDescription(3, base::ASCIIToUTF16("email"));
TestLocalizedRoleDescription(4, base::ASCIIToUTF16("telephone"));
TestLocalizedRoleDescription(5, base::ASCIIToUTF16("url"));
TestLocalizedRoleDescription(6, base::ASCIIToUTF16("meter"));
}

IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
document
++group
++group LocalizedControlType='details'
++++button Name='details tag' ExpandCollapse.ExpandCollapseState='Collapsed'
++++++description Name='details tag'
++group
++group LocalizedControlType='details'
++++button Name='details tag open' ExpandCollapse.ExpandCollapseState='Expanded'
++++++description Name='details tag open'
++++group
Expand Down
4 changes: 2 additions & 2 deletions content/test/data/accessibility/html/details-expected-win.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++ROLE_SYSTEM_GROUPING
++ROLE_SYSTEM_GROUPING localized_extended_role='details'
++++ROLE_SYSTEM_PUSHBUTTON name='details tag' COLLAPSED FOCUSABLE
++++++ROLE_SYSTEM_STATICTEXT name='details tag'
++ROLE_SYSTEM_GROUPING
++ROLE_SYSTEM_GROUPING localized_extended_role='details'
++++ROLE_SYSTEM_PUSHBUTTON name='details tag open' EXPANDED FOCUSABLE
++++++ROLE_SYSTEM_STATICTEXT name='details tag open'
++++IA2_ROLE_PARAGRAPH
Expand Down
2 changes: 2 additions & 0 deletions content/test/data/accessibility/html/details.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<!--
@MAC-ALLOW:AXRole*
@MAC-ALLOW:AXExpanded=*
@UIA-WIN-ALLOW:LocalizedControlType='details'
@WIN-ALLOW:EXPANDED
@WIN-ALLOW:COLLAPSED
@WIN-ALLOW:localized_extended_role=*
@AURALINUX-ALLOW:expand*
@AURALINUX-ALLOW:focus*
-->
Expand Down
3 changes: 3 additions & 0 deletions ui/accessibility/platform/test_ax_node_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ base::string16 TestAXNodeWrapper::GetLocalizedStringForRoleDescription() const {
case ax::mojom::Role::kAudio:
return base::ASCIIToUTF16("audio");

case ax::mojom::Role::kDetails:
return base::ASCIIToUTF16("details");

case ax::mojom::Role::kMeter:
return base::ASCIIToUTF16("meter");

Expand Down

0 comments on commit df842c7

Please sign in to comment.