Skip to content

Commit f17d63b

Browse files
committed
Don't try to dispatch from synchronous blur handler
FIX: Fix a crash when the editor lost focus during an update and autocompletion was active. Closes codemirror/dev#1316
1 parent 36067ab commit f17d63b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const completionPlugin = ViewPlugin.fromClass(class implements PluginValu
196196
if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
197197
let dialog = state.open && getTooltip(this.view, state.open.tooltip)
198198
if (!dialog || !dialog.dom.contains(event.relatedTarget as HTMLElement))
199-
this.view.dispatch({effects: closeCompletionEffect.of(null)})
199+
setTimeout(() => this.view.dispatch({effects: closeCompletionEffect.of(null)}), 10)
200200
}
201201
},
202202
compositionstart() {

0 commit comments

Comments
 (0)