Commit 1599d1be authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fixes Chrome find feedback in ChromeVox

R=dmazzoni@chromium.org

Fixed: 1068665
AX-Relnotes: Fixes Chrome find in page feedback in ChromeVox.
Change-Id: I00a434feb43da30ced04f01c63980ad568bf0233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2213238
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771353}
parent 2770346f
......@@ -38,10 +38,33 @@ FindHandler.onTextMatch_ = function(evt) {
return;
}
// When a user types, a flurry of events gets sent from the tree updates being
// applied. Drop all but the first. Note that when hitting enter, there's only
// one marker changed ever sent.
const delta = new Date() - FindHandler.lastFindMarkerReceived;
FindHandler.lastFindMarkerReceived = new Date();
if (delta < FindHandler.DROP_MATCH_WITHIN_TIME_MS) {
return;
}
const range = cursors.Range.fromNode(evt.target);
ChromeVoxState.instance.setCurrentRange(range);
new Output()
.withRichSpeechAndBraille(range, null, Output.EventType.NAVIGATE)
.go();
};
/**
* The amount of time where a subsequent find text marker is dropped from
* output.
* @const {number}
*/
FindHandler.DROP_MATCH_WITHIN_TIME_MS = 50;
/**
* The last time a find marker was received.
* @type {!Date}
*/
FindHandler.lastFindMarkerReceived = new Date();
}); // goog.scope
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