Skip to content

Commit

Permalink
Fix backspace can delete two characters
Browse files Browse the repository at this point in the history
If we're handling the backspace completely ourselves, must prevent
default to stop the browser also having a go.
  • Loading branch information
neilj committed Feb 22, 2023
1 parent 137c8f0 commit cf30a69
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions source/keyboard/Backspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cf30a69

Please sign in to comment.