avoid double handling of keyboard event in rerouter
...and thus fix the bug with restoring keyboard focus to codemirror when closing color picker
This commit is contained in:
parent
f9a2b9de35
commit
fcad0ee523
|
@ -48,8 +48,10 @@
|
|||
cm.lastActive = Date.now();
|
||||
};
|
||||
const onCmBlur = cm => {
|
||||
rerouteHotkeys.toggle(true);
|
||||
setTimeout(() => {
|
||||
/* Delaying to next tick to avoid double-processing of the currently processed keyboard event
|
||||
* when it bubbles up from CodeMirror to `document` where the rerouter listens */
|
||||
rerouteHotkeys.toggle(true);
|
||||
const {wrapper} = cm.display;
|
||||
wrapper.classList.toggle('CodeMirror-active', wrapper.contains(document.activeElement));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user