Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
external_chromium_org
Commits
40a9583e
Commit
40a9583e
authored
10 years ago
by
Hui Shu
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Download
Plain Diff
Merge "Accessible name of text fields on Android should prefer field value" into lmp-dev
parents
3dfff5ce
3ba7d4f0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
4 deletions
+57
-4
content/browser/accessibility/browser_accessibility_android.cc
...nt/browser/accessibility/browser_accessibility_android.cc
+15
-4
content/browser/accessibility/dump_accessibility_tree_browsertest.cc
...wser/accessibility/dump_accessibility_tree_browsertest.cc
+4
-0
content/test/data/accessibility/input-text-value-expected-android.txt
.../data/accessibility/input-text-value-expected-android.txt
+13
-0
content/test/data/accessibility/input-text-value-expected-mac.txt
...test/data/accessibility/input-text-value-expected-mac.txt
+1
-0
content/test/data/accessibility/input-text-value-expected-win.txt
...test/data/accessibility/input-text-value-expected-win.txt
+1
-0
content/test/data/accessibility/input-text-value.html
content/test/data/accessibility/input-text-value.html
+23
-0
No files found.
content/browser/accessibility/browser_accessibility_android.cc
View file @
40a9583e
...
...
@@ -271,10 +271,21 @@ base::string16 BrowserAccessibilityAndroid::GetText() const {
// See comment in browser_accessibility_win.cc for details.
// The difference here is that we can only expose one accessible
// name on Android, not 2 or 3 like on Windows or Mac.
//
// The basic rule is: prefer description (aria-labelledby or aria-label),
// then help (title), then name (inner text), then value (control value).
// However, if title_elem_id is set, that means there's a label element
// First, always return the |value| attribute if this is an
// accessible text.
if
(
!
value
().
empty
()
&&
(
GetRole
()
==
ui
::
AX_ROLE_EDITABLE_TEXT
||
GetRole
()
==
ui
::
AX_ROLE_TEXT_AREA
||
GetRole
()
==
ui
::
AX_ROLE_TEXT_FIELD
||
HasState
(
ui
::
AX_STATE_EDITABLE
)))
{
return
base
::
UTF8ToUTF16
(
value
());
}
// If there's no text value, the basic rule is: prefer description
// (aria-labelledby or aria-label), then help (title), then name
// (inner text), then value (control value). However, if
// title_elem_id is set, that means there's a label element
// supplying the name and then name takes precedence over help.
// TODO(dmazzoni): clean this up by providing more granular labels in
// Blink, making the platform-specific mapping to accessible text simpler.
...
...
This diff is collapsed.
Click to expand it.
content/browser/accessibility/dump_accessibility_tree_browsertest.cc
View file @
40a9583e
...
...
@@ -475,6 +475,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
RunTest
(
FILE_PATH_LITERAL
(
"input-text-name-calc.html"
));
}
IN_PROC_BROWSER_TEST_F
(
DumpAccessibilityTreeTest
,
AccessibilityInputTextValue
)
{
RunTest
(
FILE_PATH_LITERAL
(
"input-text-value.html"
));
}
// crbug.com/98976 will cause new elements to be added to the Blink a11y tree
// Re-baseline after the Blink change goes in
IN_PROC_BROWSER_TEST_F
(
DumpAccessibilityTreeTest
,
...
...
This diff is collapsed.
Click to expand it.
content/test/data/accessibility/input-text-value-expected-android.txt
0 → 100644
View file @
40a9583e
android.webkit.WebView focusable focused scrollable
android.view.View
android.view.View clickable name='l1'
android.widget.EditText editable_text focusable input_type=1
android.view.View clickable name='l2'
android.widget.EditText clickable editable_text focusable name='value' input_type=1
android.widget.EditText clickable editable_text focusable name='l2' input_type=1
android.widget.EditText clickable editable_text focusable name='value' input_type=1
android.view.View clickable name='Email'
android.widget.EditText clickable editable_text focusable name='Email' input_type=1
android.widget.EditText clickable editable_text focusable name='value' input_type=1
android.widget.EditText clickable editable_text focusable multiline name='l5'
android.widget.EditText clickable editable_text focusable multiline name='Value'
This diff is collapsed.
Click to expand it.
content/test/data/accessibility/input-text-value-expected-mac.txt
0 → 100644
View file @
40a9583e
#<skip -- need to generate>
This diff is collapsed.
Click to expand it.
content/test/data/accessibility/input-text-value-expected-win.txt
0 → 100644
View file @
40a9583e
#<skip -- need to generate>
This diff is collapsed.
Click to expand it.
content/test/data/accessibility/input-text-value.html
0 → 100644
View file @
40a9583e
<!--
@WIN-ALLOW:description*
-->
<html>
<body>
<label
for=
"i1"
>
l1
</label>
<input
id=
"i1"
>
<label
for=
"i2"
>
l2
</label>
<input
id=
"i2"
value=
"value"
>
<input
aria-label=
"l2"
>
<input
aria-label=
"l2"
value=
"value"
>
<label
id=
"l3"
>
Email
</label>
<span
id=
"l4"
></span>
<input
aria-labelledby=
"l3 42"
>
<input
aria-labelledby=
"l3 l4"
value=
"value"
>
<textarea
aria-label=
"l5"
></textarea>
<textarea
aria-label=
"l6"
>
Value
</textarea>
</body>
</html>
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment