Skip to content

Commit

Permalink
Fix missing backspace behaviour in non-Firefox browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Apr 22, 2021
1 parent 3ced8fb commit 093b10e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/useEditable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,10 @@ export const useEditable = (
const index = match ? match.index : position.content.length;
const text = '\n' + position.content.slice(0, index);
edit.insert(text);
} else if (!hasPlaintextSupport && event.key === 'Backspace') {
} else if (
(!hasPlaintextSupport || opts!.indentation) &&
event.key === 'Backspace'
) {
// Firefox Quirk: Since plaintext-only is unsupported we must
// ensure that only a single character is deleted
event.preventDefault();
Expand Down

0 comments on commit 093b10e

Please sign in to comment.