0

a11y: Export navigation role from Clank

This CL should have no effect on its own, but it allows TalkBack
and other ATs to distinguish navigation elements.

Bug: 414666411
Change-Id: I848b906e36de1ff9b4578d98fe6c8f0815b5d091
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6502144
Reviewed-by: Mark Schillaci <mschillaci@google.com>
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: Camden Bickel <cambickel@google.com>
Cr-Commit-Position: refs/heads/main@{#1455067}
This commit is contained in:
Cam Bickel
2025-05-02 10:44:37 -07:00
committed by Chromium LUCI CQ
parent a701ab1c88
commit 1728b2bd52
13 changed files with 28 additions and 23 deletions

@ -1,2 +1,2 @@
WebView textSize:16.0 style:0 htmlInfo:[{htmlTag="#document"}, {display=""}]
++View textSize:16.0 style:0 htmlInfo:[{htmlTag="div"}, {display="block"}, {role="navigation"}]
++NavigationView textSize:16.0 style:0 htmlInfo:[{htmlTag="div"}, {display="block"}, {role="navigation"}]

@ -1,2 +1,2 @@
WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="rootWebArea"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]

@ -1,2 +1,2 @@
android.webkit.WebView focusable focused
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'

@ -1,6 +1,6 @@
WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="rootWebArea"]
++TextView text:"The nav element defines a set of navigation links:" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="paragraph"]
++View containerTitle:"programming languages" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView containerTitle:"programming languages" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"null" contentDescription:"HTML" clickable focusable actions:[FOCUS, CLICK, AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="link", clickableScore="300", roleDescription="link", targetUrl="file:///html/"]
++++++TextView text:"HTML" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="staticText", clickableScore="100"]
++++TextView text:" | " actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="staticText"]

@ -1,6 +1,6 @@
android.webkit.WebView focusable focused
++android.widget.TextView interesting name='The nav element defines a set of navigation links:'
++android.view.View role_description='navigation' container_title='programming languages'
++com.google.android.material.navigation.NavigationView role_description='navigation' container_title='programming languages'
++++android.view.View role_description='link' clickable focusable link interesting name='HTML'
++++++android.widget.TextView name='HTML'
++++android.widget.TextView interesting name=' | '

@ -5,20 +5,20 @@ WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="ro
++View text:"This is a footer element." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="footer", roleDescription="footer"]
++View text:"This is a form element." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="section"]
++View text:"This is a main element." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="main", roleDescription="main"]
++View text:"This is a nav element." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView text:"This is a nav element." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++View text:"This is an ARIA application landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="application", roleDescription="application"]
++View text:"This is an ARIA banner landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="banner", roleDescription="banner"]
++View text:"This is an ARIA complementary landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="complementary", roleDescription="complementary"]
++View text:"This is an ARIA contentinfo landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="contentInfo", roleDescription="content information"]
++View text:"This is an ARIA form landmark." containerTitle:"Named form" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="form"]
++View text:"This is an ARIA main landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="main", roleDescription="main"]
++View text:"This is an ARIA navigation landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView text:"This is an ARIA navigation landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++View text:"This is an ARIA search landmark." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="search", roleDescription="search"]
++View actions:[AX_FOCUS] bundle:[chromeRole="article", roleDescription="article"]
++++View text:"This should NOT banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="complementary", roleDescription="complementary"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="section"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
@ -38,7 +38,7 @@ WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="ro
++++View text:"This should NOT banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="complementary", roleDescription="complementary"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
++View actions:[AX_FOCUS] bundle:[chromeRole="section"]
++++View text:"This should NOT have banner role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionHeader"]
@ -57,7 +57,7 @@ WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="ro
++++View text:"This should NOT footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="complementary", roleDescription="complementary"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="section"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
@ -76,7 +76,7 @@ WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="ro
++++View text:"This should NOT footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="complementary", roleDescription="complementary"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]
++View actions:[AX_FOCUS] bundle:[chromeRole="section"]
++++View text:"This should NOT have footer role." actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="sectionFooter"]

@ -5,20 +5,20 @@ android.webkit.WebView focusable focused
++android.view.View role_description='footer' interesting name='This is a footer element.'
++android.view.View interesting name='This is a form element.'
++android.view.View role_description='main' interesting name='This is a main element.'
++android.view.View role_description='navigation' interesting name='This is a nav element.'
++com.google.android.material.navigation.NavigationView role_description='navigation' interesting name='This is a nav element.'
++android.view.View role_description='application' interesting name='This is an ARIA application landmark.'
++android.view.View role_description='banner' interesting name='This is an ARIA banner landmark.'
++android.view.View role_description='complementary' interesting name='This is an ARIA complementary landmark.'
++android.view.View role_description='content information' interesting name='This is an ARIA contentinfo landmark.'
++android.view.View interesting name='This is an ARIA form landmark.' container_title='Named form'
++android.view.View role_description='main' interesting name='This is an ARIA main landmark.'
++android.view.View role_description='navigation' interesting name='This is an ARIA navigation landmark.'
++com.google.android.material.navigation.NavigationView role_description='navigation' interesting name='This is an ARIA navigation landmark.'
++android.view.View role_description='search' interesting name='This is an ARIA search landmark.'
++android.view.View role_description='article'
++++android.view.View interesting name='This should NOT banner role.'
++android.view.View role_description='complementary'
++++android.view.View interesting name='This should NOT have banner role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View interesting name='This should NOT have banner role.'
++android.view.View
++++android.view.View interesting name='This should NOT have banner role.'
@ -28,7 +28,7 @@ android.webkit.WebView focusable focused
++++android.view.View interesting name='This should NOT banner role.'
++android.view.View role_description='complementary'
++++android.view.View interesting name='This should NOT have banner role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View interesting name='This should NOT have banner role.'
++android.view.View
++++android.view.View interesting name='This should NOT have banner role.'
@ -38,7 +38,7 @@ android.webkit.WebView focusable focused
++++android.view.View interesting name='This should NOT footer role.'
++android.view.View role_description='complementary'
++++android.view.View interesting name='This should NOT have footer role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View interesting name='This should NOT have footer role.'
++android.view.View
++++android.view.View interesting name='This should NOT have footer role.'
@ -48,7 +48,7 @@ android.webkit.WebView focusable focused
++++android.view.View interesting name='This should NOT footer role.'
++android.view.View role_description='complementary'
++++android.view.View interesting name='This should NOT have footer role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View interesting name='This should NOT have footer role.'
++android.view.View
++++android.view.View interesting name='This should NOT have footer role.'
@ -58,7 +58,7 @@ android.webkit.WebView focusable focused
++++android.widget.TextView interesting name='This should NOT complementary role.'
++android.view.View role_description='complementary'
++++android.widget.TextView interesting name='This should NOT have complementary role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.widget.TextView interesting name='This should NOT have complementary role.'
++android.view.View
++++android.widget.TextView interesting name='This should NOT have complementary role.'
@ -68,7 +68,7 @@ android.webkit.WebView focusable focused
++++android.widget.TextView interesting name='This should NOT complementary role.'
++android.view.View role_description='complementary'
++++android.widget.TextView interesting name='This should NOT have complementary role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.widget.TextView interesting name='This should NOT have complementary role.'
++android.view.View
++++android.widget.TextView interesting name='This should NOT have complementary role.'
@ -78,7 +78,7 @@ android.webkit.WebView focusable focused
++++android.view.View role_description='complementary' interesting name='This should have complementary role.'
++android.view.View role_description='complementary'
++++android.view.View role_description='complementary' interesting name='This should have complementary role.'
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View role_description='complementary' interesting name='This should have complementary role.'
++android.view.View
++++android.view.View role_description='complementary' interesting name='This should have complementary role.'

@ -1,4 +1,4 @@
WebView textSize:16.0 style:0 htmlInfo:[{htmlTag="#document"}, {display=""}]
++View textSize:16.0 style:0 htmlInfo:[{htmlTag="nav"}, {display="block"}]
++NavigationView textSize:16.0 style:0 htmlInfo:[{htmlTag="nav"}, {display="block"}]
++++View textSize:16.0 style:4 fgColor:-16776978 htmlInfo:[{htmlTag="a"}, {display="inline"}, {href="/fake/"}]
++++++TextView text:"Don't click on me" textSize:16.0 style:4 fgColor:-16776978 htmlInfo:[{htmlTag=""}, {display=""}]

@ -1,4 +1,4 @@
WebView focusable focused actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="rootWebArea"]
++View actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++NavigationView actions:[AX_FOCUS] bundle:[chromeRole="navigation", roleDescription="navigation"]
++++View text:"null" contentDescription:"Don't click on me" clickable focusable actions:[FOCUS, CLICK, AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="link", clickableScore="300", roleDescription="link", targetUrl="file:///fake/"]
++++++TextView text:"Don't click on me" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="staticText", clickableScore="100"]

@ -1,4 +1,4 @@
android.webkit.WebView focusable focused
++android.view.View role_description='navigation'
++com.google.android.material.navigation.NavigationView role_description='navigation'
++++android.view.View role_description='link' clickable focusable link interesting name='Don't click on me'
++++++android.widget.TextView name='Don't click on me'

@ -441,6 +441,8 @@ const char* AXRoleToAndroidClassName(ax::mojom::Role role, bool has_parent) {
case ax::mojom::Role::kMenuItemCheckBox:
case ax::mojom::Role::kMenuItemRadio:
return kAXMenuItemClassname;
case ax::mojom::Role::kNavigation:
return kAXNavigationViewClassname;
case ax::mojom::Role::kStaticText:
return kAXTextViewClassname;
case ax::mojom::Role::kDirectoryDeprecated:

@ -26,6 +26,8 @@ const char kAXListViewClassname[] = "android.widget.ListView";
const char kAXMenuItemClassname[] = "android.view.MenuItem";
const char kAXMultiAutoCompleteTextViewClassname[] =
"android.widget.MultiAutoCompleteTextView";
const char kAXNavigationViewClassname[] =
"com.google.android.material.navigation.NavigationView";
const char kAXPagerClassname[] = "android.support.v4.view.ViewPager";
const char kAXProgressBarClassname[] = "android.widget.ProgressBar";
const char kAXRadioButtonClassname[] = "android.widget.RadioButton";

@ -31,6 +31,7 @@ COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXListViewClassname[];
COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXMenuItemClassname[];
COMPONENT_EXPORT(AX_PLATFORM)
extern const char kAXMultiAutoCompleteTextViewClassname[];
COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXNavigationViewClassname[];
COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXPagerClassname[];
COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXProgressBarClassname[];
COMPONENT_EXPORT(AX_PLATFORM) extern const char kAXRadioButtonClassname[];