Skip to content

Commit

Permalink
Fix deletion of selected inline void nodes in Safari (#4331)
Browse files Browse the repository at this point in the history
Co-authored-by: Claudéric Demers <clauderic.d@gmail.com>
  • Loading branch information
golota60 and clauderic committed Jun 9, 2021
1 parent 6c99352 commit a3bc97a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/safari-delete-inlinevoid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

Fix deletion of selected inline void nodes in Safari when presssing `backspace` or `delete`. This is a bug that [was originally fixed only for Google Chrome](https://github.com/ianstormtaylor/slate/issues/3456), but the fix also needs to be applied in Safari.
4 changes: 2 additions & 2 deletions packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,8 @@ export const Editable = (props: EditableProps) => {
return
}
} else {
if (IS_CHROME) {
// COMPAT: Chrome supports `beforeinput` event but does not fire
if (IS_CHROME || IS_SAFARI) {
// COMPAT: Chrome and Safari support `beforeinput` event but do not fire
// an event when deleting backwards in a selected void inline node
if (
selection &&
Expand Down

0 comments on commit a3bc97a

Please sign in to comment.