New issue
Advanced search Search tips

Issue 632450 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug
Team-Accessibility



Sign in to add a comment

Accessible text selection needs to know affinity

Project Member Reported by dmazz...@chromium.org, Jul 28 2016

Issue description

In text editing, it's possible for the cursor offset to be ambiguous, i.e. the cursor position is right between two characters, one on the previous line and one on the next line.

There are actually two different visible positions on screen that correspond to the same character offset.

In Blink this concept is represented by TextAffinity. An affinity of upstream means the cursor is on the previous line, and downstream means it's on the next line. The affinity has no effect when the cursor position is not ambiguous like that.

To reproduce this bug, load the following url:

data:text/html,<textarea autofocus style="width:3em;">1-2-3-4-5-6-</textarea>

As an explanation, this text box is very narrow so it won't all fit on one line, but Blink will wrap at hyphens by default. This is an easy way to create a situation where there's an ambiguous cursor position.

To repro the bug, focus the text box and then press the right arrow until the cursor is at the end. You must press the right arrow, don't use down arrow or End or you might not get the same result!

Once you're at the end, press the up arrow. It should now be at the end of the previous line, however VoiceOver and probably other screen readers are announcing the last line, because the cursor index into the text is ambiguous.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 1 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/25a949f677564d5e7ee1e7379528fd9c79a6ed6e

commit 25a949f677564d5e7ee1e7379528fd9c79a6ed6e
Author: dmazzoni <dmazzoni@chromium.org>
Date: Mon Aug 01 17:20:44 2016

Use text affinity to return correct accessible line boundaries.

Our calculations of line boundaries for accessibility were wrong
in certain cases where the character offset is ambiguous. It's
possible for there to be a line break immediately between two
characters, such that one character is on the previous line and
one is on the next line. If the character index is between those
two characters, previously we had no way of knowing if the cursor
was on the first line or second line.

Fix this by passing through the text affinity of the selection
focus and anchor from Blink all the way into Chrome's accessibility
tree. If the affinity is upstream, it means the cursor is on the
previous line, and downstream means the next line.

I added a LayoutTest for Blink and a unit test for Chrome. I also
manually verified this fixes at least one broken case with VoiceOver,
see the bug for a very specific repro.

BUG= 632450 

Review-Url: https://codereview.chromium.org/2191833003
Cr-Commit-Position: refs/heads/master@{#408989}

[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/chrome/common/extensions/chrome_extension_messages.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/components/test_runner/web_ax_object_proxy.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/components/test_runner/web_ax_object_proxy.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/browser/accessibility/browser_accessibility.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/browser/accessibility/browser_accessibility.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/browser/accessibility/browser_accessibility_cocoa.mm
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/browser/accessibility/browser_accessibility_manager_unittest.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/browser/accessibility/browser_accessibility_win.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/common/accessibility_messages.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/public/common/common_param_traits_macros.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/renderer/accessibility/blink_ax_enum_conversion.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/renderer/accessibility/blink_ax_enum_conversion.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/content/renderer/accessibility/blink_ax_tree_source.cc
[add] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/LayoutTests/accessibility/selection-affinity.html
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/Source/modules/accessibility/AXObject.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/Source/web/AssertMatchingEnums.cpp
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/Source/web/WebAXObject.cpp
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/public/web/WebAXEnums.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/third_party/WebKit/public/web/WebAXObject.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_enums.idl
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_text_utils.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_text_utils.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_text_utils_unittest.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_tree_data.cc
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/ax_tree_data.h
[modify] https://crrev.com/25a949f677564d5e7ee1e7379528fd9c79a6ed6e/ui/accessibility/platform/ax_platform_node_win.cc

Status: Fixed (was: Started)

Sign in to add a comment