From cf30a69b89f453e014e9371ffcff41530709b09c Mon Sep 17 00:00:00 2001 From: Neil Jenkins <neil@nmjenkins.com> Date: Wed, 22 Feb 2023 11:27:16 +1100 Subject: [PATCH] Fix backspace can delete two characters If we're handling the backspace completely ourselves, must prevent default to stop the browser also having a go. --- source/keyboard/Backspace.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/source/keyboard/Backspace.ts b/source/keyboard/Backspace.ts index 5da03596..01fe1a71 100644 --- a/source/keyboard/Backspace.ts +++ b/source/keyboard/Backspace.ts @@ -94,6 +94,7 @@ const Backspace = (self: Squire, event: KeyboardEvent, range: Range): void => { text.deleteData(offset - 1, 1); self.setSelection(range); self.removeLink(); + event.preventDefault(); } else { // Otherwise, leave to browser but check afterwards whether it has // left behind an empty inline tag.