Skip to content

Commit

Permalink
Don't try to dispatch from synchronous blur handler
Browse files Browse the repository at this point in the history
FIX: Fix a crash when the editor lost focus during an update and autocompletion
was active.

Closes codemirror/dev#1316
  • Loading branch information
marijnh committed Jan 9, 2024
1 parent 36067ab commit f17d63b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/view.ts
Expand Up @@ -196,7 +196,7 @@ export const completionPlugin = ViewPlugin.fromClass(class implements PluginValu
if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
let dialog = state.open && getTooltip(this.view, state.open.tooltip)
if (!dialog || !dialog.dom.contains(event.relatedTarget as HTMLElement))
this.view.dispatch({effects: closeCompletionEffect.of(null)})
setTimeout(() => this.view.dispatch({effects: closeCompletionEffect.of(null)}), 10)
}
},
compositionstart() {
Expand Down

0 comments on commit f17d63b

Please sign in to comment.