Commit f9e118bb authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fixes a specific case for select all output in ChromeVox

R=akihiroota@chromium.org, katie@chromium.org

Fixed: 817636
AX-Relnotes: ChromeVox correctly provides spoken feedback when performing a select all (ctrl+a) on a multiline editable text field that contains only a single line.
Change-Id: I4b83cb044c496dab14ba6c43068cb4295ea1bcc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2288089Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786607}
parent ecf0ee81
......@@ -1038,15 +1038,16 @@ editing.EditableLine = class {
// cursors.Cursor.deepEquivalent results in cursors to different container
// nodes. The cursors can point directly to inline text boxes, in which case
// we should not adjust the container start or end index.
if (startNode.role != RoleType.INLINE_TEXT_BOX &&
this.start_.node != startNode && this.start_.node.parent != startNode) {
if (!AutomationPredicate.text(startNode) ||
(this.start_.node != startNode &&
this.start_.node.parent != startNode)) {
startIndex = this.start_.index == cursors.NODE_INDEX ?
this.start_.node.name.length :
this.start_.index;
}
if (endNode.role != RoleType.INLINE_TEXT_BOX && this.end_.node != endNode &&
this.end_.node.parent != endNode) {
if (!AutomationPredicate.text(endNode) ||
(this.end_.node != endNode && this.end_.node.parent != endNode)) {
endIndex = this.end_.index == cursors.NODE_INDEX ?
this.end_.node.name.length :
this.end_.index;
......
......@@ -1437,3 +1437,22 @@ TEST_F('ChromeVoxEditingTest', 'MoveByLineIntent', function() {
input.focus();
});
});
TEST_F('ChromeVoxEditingTest', 'SelectAllBareTextContent', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
<div contenteditable role="textbox">unread</div>
`,
function(root) {
const input = root.find({role: RoleType.TEXT_FIELD});
this.listenOnce(input, 'focus', function() {
mockFeedback.call(this.press(35 /* end */, {ctrl: true}))
.expectSpeech('unread')
.call(this.press(65 /* a */, {ctrl: true}))
.expectSpeech('unread', 'selected')
.replay();
});
input.focus();
});
});
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