Commit 754d5e5a authored by Joel Riley's avatar Joel Riley Committed by Chromium LUCI CQ

Highlight paragraph when word highlighting is disabled and nav controls enabled.

Previously disabling word highlighting caused focus ring to highlight individual nodes instead of paragraphs, which caused the navigation control panel to bounce around too quickly.

Bug: 1157941
Change-Id: I3f73ac13f8595df9ceb5c205e1fb0c1041654931
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587489Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Joel Riley <joelriley@google.com>
Cr-Commit-Position: refs/heads/master@{#836705}
parent fb2ebbc7
...@@ -1541,10 +1541,22 @@ class SelectToSpeak { ...@@ -1541,10 +1541,22 @@ class SelectToSpeak {
if (!this.visible_) { if (!this.visible_) {
return; return;
} }
const node = nodeGroupItem.hasInlineText && this.currentNodeWord_ ? let node;
ParagraphUtils.findInlineTextNodeByCharacterIndex( if (nodeGroupItem.hasInlineText && this.currentNodeWord_) {
nodeGroupItem.node, this.currentNodeWord_.start) : node = ParagraphUtils.findInlineTextNodeByCharacterIndex(
nodeGroupItem.node; nodeGroupItem.node, this.currentNodeWord_.start);
} else if (
nodeGroupItem.hasInlineText && this.shouldShowNavigationControls_()) {
// If navigation controls are enabled, but word highlighting is disabled
// (currentNodeWord_ === null), still find the inline text node so the
// focus ring will highlight the whole block.
node = ParagraphUtils.findInlineTextNodeByCharacterIndex(
nodeGroupItem.node, 0);
} else {
// No inline text or word highlighting and navigation controls are
// disabled.
node = nodeGroupItem.node;
}
if (this.scrollToSpokenNode_ && node.state.offscreen) { if (this.scrollToSpokenNode_ && node.state.offscreen) {
node.makeVisible(); node.makeVisible();
} }
......
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