Commit b15cf45b authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Force VoiceOver to use Chrome's computed text for links.

VoiceOver was incorrectly reading links that contained
absolute-positioned text inside. As a workaround, expose
the text of a link in AXDescription instead of AXTitle.
That forces VoiceOver to treat it similarly to a link that
has an aria-label on it, so it favor's Chrome's accessible
text, rather than treating it as a link containing visible
text and using its own (broken) heuristics to describe
what's inside.

It's possible this could have a side effect, if VoiceOver
was announcing more detailed information inside a link.
But it'd still be possible to access the contents of the
link, so this is probably okay.

Bug: 1048782

Change-Id: I2764afe80af1f6afc4c191cf7f98bbcb6b3c025f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037710
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738791}
parent 98027385
...@@ -1747,6 +1747,10 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; ...@@ -1747,6 +1747,10 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
break; break;
} }
// VoiceOver computes the wrong description for a link.
if (ui::IsLink(_owner->GetRole()))
return true;
// VoiceOver will not read the label of a fieldset or radiogroup unless it is // VoiceOver will not read the label of a fieldset or radiogroup unless it is
// exposed in the description instead of the title. // exposed in the description instead of the title.
switch (_owner->GetRole()) { switch (_owner->GetRole()) {
......
AXWebArea AXRoleDescription='HTML content' AXWebArea AXRoleDescription='HTML content'
++AXGroup AXRoleDescription='group' ++AXGroup AXRoleDescription='group'
++++AXLink AXRoleDescription='link' AXTitle='Group Link1' ++++AXLink AXRoleDescription='link' AXDescription='Group Link1'
++++++AXStaticText AXRoleDescription='text' AXValue='Group Link1' ++++++AXStaticText AXRoleDescription='text' AXValue='Group Link1'
++++AXLink AXRoleDescription='link' AXTitle='Group Link2' ++++AXLink AXRoleDescription='link' AXDescription='Group Link2'
++++++AXStaticText AXRoleDescription='text' AXValue='Group Link2' ++++++AXStaticText AXRoleDescription='text' AXValue='Group Link2'
\ No newline at end of file
AXWebArea AXRoleDescription='HTML content' AXWebArea AXRoleDescription='HTML content'
++AXLink AXRoleDescription='link' AXTitle='ARIA Link' ++AXLink AXRoleDescription='link' AXDescription='ARIA Link'
++++AXStaticText AXRoleDescription='text' AXValue='ARIA Link' ++++AXStaticText AXRoleDescription='text' AXValue='ARIA Link'
\ No newline at end of file
AXWebArea AXWebArea
++AXOutline AXARIASetSize='2' ++AXOutline AXARIASetSize='2'
++++AXRow AXTitle='Animals' AXValue='2' AXARIASetSize='2' AXARIAPosInSet='1' ++++AXRow AXTitle='Animals' AXValue='2' AXARIASetSize='2' AXARIAPosInSet='1'
++++++AXLink AXTitle='Animals' ++++++AXLink AXDescription='Animals'
++++++++AXStaticText AXValue='Animals' ++++++++AXStaticText AXValue='Animals'
++++++AXGroup AXARIASetSize='2' ++++++AXGroup AXARIASetSize='2'
++++++++AXRow AXTitle='Domesticated' AXARIASetSize='2' AXARIAPosInSet='1' ++++++++AXRow AXTitle='Domesticated' AXARIASetSize='2' AXARIAPosInSet='1'
++++++++++AXLink AXTitle='Domesticated' ++++++++++AXLink AXDescription='Domesticated'
++++++++++++AXStaticText AXValue='Domesticated' ++++++++++++AXStaticText AXValue='Domesticated'
++++++++++AXGroup AXARIASetSize='2' ++++++++++AXGroup AXARIASetSize='2'
++++++++++++AXRow AXTitle='Dog' AXValue='1' AXARIASetSize='2' AXARIAPosInSet='1' ++++++++++++AXRow AXTitle='Dog' AXValue='1' AXARIASetSize='2' AXARIAPosInSet='1'
++++++++++++++AXLink AXTitle='Dog' ++++++++++++++AXLink AXDescription='Dog'
++++++++++++++++AXStaticText AXValue='Dog' ++++++++++++++++AXStaticText AXValue='Dog'
++++++++++++AXRow AXTitle='Cat' AXValue='0' AXARIASetSize='2' AXARIAPosInSet='2' ++++++++++++AXRow AXTitle='Cat' AXValue='0' AXARIASetSize='2' AXARIAPosInSet='2'
++++++++++++++AXLink AXTitle='Cat' ++++++++++++++AXLink AXDescription='Cat'
++++++++++++++++AXStaticText AXValue='Cat' ++++++++++++++++AXStaticText AXValue='Cat'
++++++++AXRow AXTitle='Wild' AXARIASetSize='2' AXARIAPosInSet='2' ++++++++AXRow AXTitle='Wild' AXARIASetSize='2' AXARIAPosInSet='2'
++++++++++AXLink AXTitle='Wild' ++++++++++AXLink AXDescription='Wild'
++++++++++++AXStaticText AXValue='Wild' ++++++++++++AXStaticText AXValue='Wild'
++++AXRow AXTitle='Plants' AXARIASetSize='2' AXARIAPosInSet='2' ++++AXRow AXTitle='Plants' AXARIASetSize='2' AXARIAPosInSet='2'
++++++AXLink AXTitle='Plants' ++++++AXLink AXDescription='Plants'
++++++++AXStaticText AXValue='Plants' ++++++++AXStaticText AXValue='Plants'
\ No newline at end of file
AXExpandedChanged on AXLink AXTitle="Toggle" AXExpandedChanged on AXLink AXDescription="Toggle"
\ No newline at end of file
AXWebArea AXWebArea
++AXGroup ++AXGroup
++++AXLink AXTitle='normal link' ++++AXLink AXDescription='normal link'
++++++AXStaticText AXValue='normal link' ++++++AXStaticText AXValue='normal link'
\ No newline at end of file
AXWebArea AXWebArea
++AXGroup AXTitle='named anchor' ++AXGroup AXTitle='named anchor'
++++AXStaticText AXValue='named anchor' ++++AXStaticText AXValue='named anchor'
++AXLink AXTitle='both a named anchor and a link' ++AXLink AXDescription='both a named anchor and a link'
++++AXStaticText AXValue='both a named anchor and a link' ++++AXStaticText AXValue='both a named anchor and a link'
\ No newline at end of file
AXWebArea AXWebArea
++AXGroup ++AXGroup
++++AXLink AXTitle='Link with image at start.' ++++AXLink AXDescription='Link with image at start.'
++++++AXImage AXDescription='Link' ++++++AXImage AXDescription='Link'
++++++AXStaticText AXValue=' with image at start.' ++++++AXStaticText AXValue=' with image at start.'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink AXTitle='Link with image in the middle.' ++++AXLink AXDescription='Link with image in the middle.'
++++++AXStaticText AXValue='Link with ' ++++++AXStaticText AXValue='Link with '
++++++AXImage AXDescription='image' ++++++AXImage AXDescription='image'
++++++AXStaticText AXValue=' in the middle.' ++++++AXStaticText AXValue=' in the middle.'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink AXTitle='Link with broken in the middle.' ++++AXLink AXDescription='Link with broken in the middle.'
++++++AXStaticText AXValue='Link with ' ++++++AXStaticText AXValue='Link with '
++++++AXImage AXDescription='broken' ++++++AXImage AXDescription='broken'
++++++AXStaticText AXValue=' in the middle.' ++++++AXStaticText AXValue=' in the middle.'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink AXTitle='Link with image at the end' ++++AXLink AXDescription='Link with image at the end'
++++++AXStaticText AXValue='Link with image at the ' ++++++AXStaticText AXValue='Link with image at the '
++++++AXImage AXDescription='end' ++++++AXImage AXDescription='end'
\ No newline at end of file
...@@ -3,5 +3,5 @@ AXWebArea ...@@ -3,5 +3,5 @@ AXWebArea
++++AXGroup ++++AXGroup
++++++AXStaticText AXValue='Static fallback' ++++++AXStaticText AXValue='Static fallback'
++++AXGroup ++++AXGroup
++++++AXLink AXTitle='Interactive fallback' ++++++AXLink AXDescription='Interactive fallback'
++++++++AXStaticText AXValue='Interactive fallback' ++++++++AXStaticText AXValue='Interactive fallback'
\ No newline at end of file
AXWebArea AXWebArea
++AXGroup ++AXGroup
++++AXLink AXTitle='unread ' ++++AXLink AXDescription='unread '
++++++AXStaticText AXValue='unread ' ++++++AXStaticText AXValue='unread '
++++AXLink AXTitle='read ' ++++AXLink AXDescription='read '
++++++AXStaticText AXValue='read ' ++++++AXStaticText AXValue='read '
++++AXLink AXTitle='read ' ++++AXLink AXDescription='read '
++++++AXStaticText AXValue='read ' ++++++AXStaticText AXValue='read '
++++AXLink AXTitle='read' ++++AXLink AXDescription='read'
++++++AXImage AXDescription='/read.jpg' ++++++AXImage AXDescription='/read.jpg'
++++++AXStaticText AXValue='read' ++++++AXStaticText AXValue='read'
\ No newline at end of file
AXWebArea AXWebArea
++AXLink AXTitle='Empty anchor' AXLinkedUIElements=["AXGroup"] ++AXLink AXDescription='Empty anchor' AXLinkedUIElements=["AXGroup"]
++++AXStaticText AXValue='Empty anchor' ++++AXStaticText AXValue='Empty anchor'
++AXStaticText AXValue=' ' ++AXStaticText AXValue=' '
++AXLink AXTitle='Anchor with content' AXLinkedUIElements=["AXGroup Anchor with content"] ++AXLink AXDescription='Anchor with content' AXLinkedUIElements=["AXGroup Anchor with content"]
++++AXStaticText AXValue='Anchor with content' ++++AXStaticText AXValue='Anchor with content'
++AXStaticText AXValue=' ' ++AXStaticText AXValue=' '
++AXLink AXTitle='Anchor with ID' AXLinkedUIElements=["AXGroup Anchor with ID"] ++AXLink AXDescription='Anchor with ID' AXLinkedUIElements=["AXGroup Anchor with ID"]
++++AXStaticText AXValue='Anchor with ID' ++++AXStaticText AXValue='Anchor with ID'
++AXStaticText AXValue=' ' ++AXStaticText AXValue=' '
++AXLink AXTitle='Empty span' AXLinkedUIElements=["AXGroup"] ++AXLink AXDescription='Empty span' AXLinkedUIElements=["AXGroup"]
++++AXStaticText AXValue='Empty span' ++++AXStaticText AXValue='Empty span'
++AXStaticText AXValue=' ' ++AXStaticText AXValue=' '
++AXLink AXTitle='Span with content' AXLinkedUIElements=["AXGroup"] ++AXLink AXDescription='Span with content' AXLinkedUIElements=["AXGroup"]
++++AXStaticText AXValue='Span with content' ++++AXStaticText AXValue='Span with content'
++AXStaticText AXValue=' ' ++AXStaticText AXValue=' '
++AXLink AXTitle='Paragraph with content' AXLinkedUIElements=["AXGroup"] ++AXLink AXDescription='Paragraph with content' AXLinkedUIElements=["AXGroup"]
++++AXStaticText AXValue='Paragraph with content' ++++AXStaticText AXValue='Paragraph with content'
++AXGroup ++AXGroup
++++AXGroup ++++AXGroup
...@@ -32,4 +32,4 @@ AXWebArea ...@@ -32,4 +32,4 @@ AXWebArea
++++AXGroup ++++AXGroup
++++++AXStaticText AXValue='Span with content' ++++++AXStaticText AXValue='Span with content'
++AXGroup ++AXGroup
++++AXStaticText AXValue='Paragraph with content' ++++AXStaticText AXValue='Paragraph with content'
\ No newline at end of file
AXWebArea AXWebArea
++AXHeading AXTitle='Link In Heading' AXValue='1' ++AXHeading AXTitle='Link In Heading' AXValue='1'
++++AXLink AXTitle='Link In Heading' ++++AXLink AXDescription='Link In Heading'
++++++AXStaticText AXValue='Link In Heading' ++++++AXStaticText AXValue='Link In Heading'
\ No newline at end of file
...@@ -2,5 +2,5 @@ AXWebArea ...@@ -2,5 +2,5 @@ AXWebArea
++AXGroup ++AXGroup
++AXGroup AXSubrole=AXApplicationDialog ++AXGroup AXSubrole=AXApplicationDialog
++++AXStaticText AXValue='The dialog subtree should be the only text content in the accessibility tree. ' ++++AXStaticText AXValue='The dialog subtree should be the only text content in the accessibility tree. '
++++AXLink AXTitle='Link inside the dialog.' ++++AXLink AXDescription='Link inside the dialog.'
++++++AXStaticText AXValue='Link inside the dialog.' ++++++AXStaticText AXValue='Link inside the dialog.'
\ No newline at end of file
AXWebArea AXRoleDescription='HTML content' AXWebArea AXRoleDescription='HTML content'
++AXGroup AXSubrole=AXLandmarkNavigation AXRoleDescription='navigation' ++AXGroup AXSubrole=AXLandmarkNavigation AXRoleDescription='navigation'
++++AXLink AXRoleDescription='link' AXTitle='Don't click on me' ++++AXLink AXRoleDescription='link' AXDescription='Don't click on me'
++++++AXStaticText AXRoleDescription='text' AXValue='Don't click on me' ++++++AXStaticText AXRoleDescription='text' AXValue='Don't click on me'
\ No newline at end of file
...@@ -12,30 +12,30 @@ AXWebArea ...@@ -12,30 +12,30 @@ AXWebArea
++AXGroup ++AXGroup
++++AXStaticText AXValue='E1. Eat' ++++AXStaticText AXValue='E1. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink ++++AXLink AXDescription='space'
++++++AXStaticText AXValue='space' ++++++AXStaticText AXValue='space'
++AXGroup ++AXGroup
++++AXStaticText AXValue='E2. Eat' ++++AXStaticText AXValue='E2. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink ++++AXLink AXDescription='space'
++++++AXStaticText AXValue='space' ++++++AXStaticText AXValue='space'
++AXGroup ++AXGroup
++++AXStaticText AXValue='E3. Eat' ++++AXStaticText AXValue='E3. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXLink ++++AXLink AXDescription='space'
++++++AXStaticText AXValue='space' ++++++AXStaticText AXValue='space'
++AXGroup ++AXGroup
++++AXLink ++++AXLink AXDescription='E4. Eat'
++++++AXStaticText AXValue='E4. Eat' ++++++AXStaticText AXValue='E4. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXStaticText AXValue='space' ++++AXStaticText AXValue='space'
++AXGroup ++AXGroup
++++AXLink ++++AXLink AXDescription='E5. Eat'
++++++AXStaticText AXValue='E5. Eat' ++++++AXStaticText AXValue='E5. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXStaticText AXValue='space' ++++AXStaticText AXValue='space'
++AXGroup ++AXGroup
++++AXLink ++++AXLink AXDescription='E6. Eat'
++++++AXStaticText AXValue='E6. Eat' ++++++AXStaticText AXValue='E6. Eat'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXStaticText AXValue='space' ++++AXStaticText AXValue='space'
...@@ -67,4 +67,4 @@ AXWebArea ...@@ -67,4 +67,4 @@ AXWebArea
++AXGroup ++AXGroup
++++AXStaticText AXValue='K8. Keep' ++++AXStaticText AXValue='K8. Keep'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXStaticText AXValue='space' ++++AXStaticText AXValue='space'
\ No newline at end of file
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