Skip to content

Commit

Permalink
Try to detect when Safari fails to fire a compositionend event
Browse files Browse the repository at this point in the history
FIX: Fix the editor getting stuck in composition when Safari fails to fire a
compositionend event for a dead key composition.

Issue codemirror/dev#1324
  • Loading branch information
marijnh committed Mar 20, 2024
1 parent 3ff175a commit 0c538f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ handlers.beforeinput = (view, event) => {
// keyboard.
view.observer.flushSoon()
}
// Safari will occasionally forget to fire compositionend at the end of a dead-key composition
if (browser.safari && event.inputType == "insertText" && view.inputState.composing >= 0) {
setTimeout(() => observers.compositionend(view, event), 20)
}

return false
}

Expand Down

0 comments on commit 0c538f7

Please sign in to comment.