Skip to content

Commit

Permalink
Avoid duplicating the effect of ctrl-d on iOS
Browse files Browse the repository at this point in the history
FIX: Work around the fact that Mobile Safari makes DOM changes before firing
a key event when typing ctrl-d on an external keyboard.

Issue codemirror/dev#1343
  • Loading branch information
marijnh committed Mar 11, 2024
1 parent be6aad9 commit 4c8fff5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,12 @@ handlers.beforeinput = (view, event) => {
}, 100)
}
}
if (browser.ios && event.inputType == "deleteContentForward") {
// For some reason, DOM changes (and beforeinput) happen _before_
// the key event for ctrl-d on iOS when using an external
// keyboard.
view.observer.flushSoon()
}
return false
}

Expand Down

0 comments on commit 4c8fff5

Please sign in to comment.