summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-12-19 16:00:47 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-12-20 12:28:57 -0500
commitc1b85cc308d0b3afe86e1598afb769d2926a1e67 (patch)
tree005a5769973d9ad5610d903fbf070132e127a5b3 /ext/mixed/js
parente6a996a206a83648d1fce9ea43e0a738bf958ff7 (diff)
Focus the current entry earlier in the generation process (#1137)
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 05b67bbd..dac99e4b 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -843,6 +843,7 @@ class Display extends EventDispatcher {
}
let {sentence=null, optionsContext=null, focusEntry=null, scrollX=null, scrollY=null} = state;
+ if (typeof focusEntry !== 'number') { focusEntry = 0; }
if (!(typeof optionsContext === 'object' && optionsContext !== null)) {
optionsContext = this.getOptionsContext();
state.optionsContext = optionsContext;
@@ -907,9 +908,11 @@ class Display extends EventDispatcher {
entry.dataset.index = `${i}`;
this._addEntryEventListeners(entry);
container.appendChild(entry);
+ if (focusEntry === i) {
+ this._focusEntry(i, false);
+ }
}
- this._focusEntry(typeof focusEntry === 'number' ? focusEntry : 0, false);
if (typeof scrollX === 'number' || typeof scrollY === 'number') {
let {x, y} = this._windowScroll;
if (typeof scrollX === 'number') { x = scrollX; }