Commit 859443ca authored by David Tseng's avatar David Tseng Committed by Commit Bot

MakesChromeVox read from here skip blank items

In Play Books, the app uses anchors which are focusable but have no
name. ChromeVox continuous "read from here" (Search+R), uses readable text to
get end callbacks from tts to know when to continue reading the next item, so
this breaks the feature from continuing.

Fix by explicitly skipping empty nodes.

R=hirokisato@chromium.org

empty items.

Bug: none
Change-Id: Iaa90677a89e8fbfea3da72d52fcb5a191e425c3c
AX-Relnotes: in Play Books, ChromeVox will keep reading even when encountering
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2448993
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarHiroki Sato <hirokisato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814247}
parent b618fb38
......@@ -3120,3 +3120,16 @@ TEST_F('ChromeVoxBackgroundTest', 'WrapTextFieldAtEndOfDoc', function() {
.replay();
});
});
TEST_F('ChromeVoxBackgroundTest', 'ReadFromHereBlankNodes', function() {
const mockFeedback = this.createMockFeedback();
const site = `<a tabindex=0></a><p>start</p><a tabindex=0></a><p>end</p>`;
this.runWithLoadedTree(site, function(root) {
assertEquals(
RoleType.ANCHOR, ChromeVoxState.instance.currentRange.start.node.role);
mockFeedback.call(doCmd('readFromHere'))
.expectSpeech('start', 'end')
.replay();
});
});
......@@ -728,23 +728,37 @@ CommandHandler.onCommand = function(command) {
newRange.select();
new Output()
.withoutHints()
.withRichSpeechAndBraille(
ChromeVoxState.instance.currentRange, prevRange,
Output.EventType.NAVIGATE)
.onSpeechEnd(continueReading)
.go();
const o = new Output()
.withoutHints()
.withRichSpeechAndBraille(
ChromeVoxState.instance.currentRange, prevRange,
Output.EventType.NAVIGATE)
.onSpeechEnd(continueReading);
if (!o.hasSpeech) {
continueReading();
return;
}
o.go();
}.bind(this);
const startNode = ChromeVoxState.instance.currentRange.start.node;
const collapsedRange = cursors.Range.fromNode(startNode);
new Output()
.withoutHints()
.withRichSpeechAndBraille(
collapsedRange, collapsedRange, Output.EventType.NAVIGATE)
.onSpeechEnd(continueReading)
.go();
{
const startNode = ChromeVoxState.instance.currentRange.start.node;
const collapsedRange = cursors.Range.fromNode(startNode);
const o =
new Output()
.withoutHints()
.withRichSpeechAndBraille(
collapsedRange, collapsedRange, Output.EventType.NAVIGATE)
.onSpeechEnd(continueReading);
if (o.hasSpeech) {
o.go();
} else {
continueReading();
}
}
return false;
case 'contextMenu':
if (ChromeVoxState.instance.currentRange) {
......
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