Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit db0f7d4

Browse files
committed
Fixes #205 Multiple results overlay is wrongly opened if previously closing Voice Fill through ESC key while in the "Processing..." overlay
1 parent 95efd3d commit db0f7d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

extension/content.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@
329329
this.dismissPopup = function (e) {
330330
const key = e.which || e.keyCode;
331331
if (key === 27) {
332+
SpeakToMePopup.cancelFetch = true;
332333
e.preventDefault();
333334
metrics.end_session();
334335
SpeakToMePopup.hide();
@@ -613,7 +614,7 @@
613614
copy.innerHTML = `<div id="stm-listening-text">Listening...</div>`
614615

615616
mediaRecorder.onstop = e => {
616-
metrics.stop_recording();
617+
metrics.stop_recording();
617618
// handle clicking on close element by dumping recording data
618619
if (SpeakToMePopup.closeClicked) {
619620
SpeakToMePopup.closeClicked = false;
@@ -660,6 +661,10 @@
660661
return response.json();
661662
})
662663
.then(json => {
664+
if (SpeakToMePopup.cancelFetch) {
665+
SpeakToMePopup.cancelFetch = false;
666+
return;
667+
}
663668
console.log(
664669
`Got STT result: ${JSON.stringify(json)}`
665670
);
@@ -696,6 +701,9 @@
696701

697702
// Click handler for stm icon
698703
const on_stm_icon_click = event => {
704+
if (SpeakToMePopup.cancelFetch) {
705+
SpeakToMePopup.cancelFetch = false;
706+
}
699707
const type = event.detail ? "button" : "keyboard";
700708
event.preventDefault();
701709
metrics.start_session(type);

0 commit comments

Comments
 (0)