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

Commit 9041d54

Browse files
authored
Merge pull request #139 from mozilla/add-cd4
add cd3 and fix short input
2 parents 9ce2fef + 1637f0c commit 9041d54

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

extension/content.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181

182182
input.confidence = DOMPurify.sanitize(firstChoice.confidence);
183183
input.value = DOMPurify.sanitize(firstChoice.text);
184-
input.size = input.value.length;
184+
input.size = Math.max(input.value.length, 10);
185185
input.idx_suggestion = 0;
186186

187187
if (list) {
@@ -197,12 +197,14 @@
197197
list.classList.add('close');
198198
resolve(input);
199199
}
200-
else if(e.keyCode === 8) {
201-
input.size--;
202-
list.style.width = `${input.offsetWidth}px`;
200+
else if(e.keyCode === 8 || e.keyCode === 46) {
201+
if (input.size > 10) {
202+
input.size--;
203+
list.style.width = `${input.offsetWidth}px`;
204+
}
203205
}
204206
else if(e.keyCode < 37 || e.keyCode > 40) {
205-
input.size = input.value.length;
207+
input.size = Math.max(10, input.value.length);
206208
list.style.width = `${input.offsetWidth}px`;
207209
}
208210
});
@@ -464,8 +466,9 @@
464466

465467
// Click handler for stm icon
466468
const on_stm_icon_click = event => {
469+
const type = event.detail ? "button" : "keyboard";
467470
event.preventDefault();
468-
metrics.start_session();
471+
metrics.start_session(type);
469472
event.target.classList.add("stm-hidden");
470473
event.target.disabled = true;
471474
SpeakToMePopup.showAt(event.clientX, event.clientY);

extension/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
padding: 4px 8px;
208208
position: relative;
209209
transition: background 75ms, box-shadow 75ms;
210-
max-width: 20vw;
210+
max-width: 600px;
211211
}
212212

213213
#stm-input:focus {

0 commit comments

Comments
 (0)