From 3c3ea29a2d7c70bab3629f0f78ea28dca4058b53 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Mon, 3 Apr 2023 19:00:59 +0100 Subject: [PATCH] Fix issue when tabbing into editor in Safari (#5383) https://github.com/udecode/plate/issues/2315 --- .changeset/cool-baboons-turn.md | 5 +++++ packages/slate-react/src/components/leaf.tsx | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/cool-baboons-turn.md diff --git a/.changeset/cool-baboons-turn.md b/.changeset/cool-baboons-turn.md new file mode 100644 index 0000000000..0ba052d0f3 --- /dev/null +++ b/.changeset/cool-baboons-turn.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fix issue when tabbing into editor in Safari (https://github.com/udecode/plate/issues/2315) diff --git a/packages/slate-react/src/components/leaf.tsx b/packages/slate-react/src/components/leaf.tsx index 1dedcbe201..d8bcf4d194 100644 --- a/packages/slate-react/src/components/leaf.tsx +++ b/packages/slate-react/src/components/leaf.tsx @@ -15,6 +15,7 @@ import { } from '../utils/weak-maps' import { RenderLeafProps, RenderPlaceholderProps } from './editable' import { useSlateStatic } from '../hooks/use-slate-static' +import { IS_SAFARI } from '../utils/environment' function disconnectPlaceholderResizeObserver( placeholderResizeObserver: MutableRefObject, @@ -125,6 +126,8 @@ const Leaf = (props: { opacity: '0.333', userSelect: 'none', textDecoration: 'none', + // Fixes https://github.com/udecode/plate/issues/2315 + WebkitUserModify: IS_SAFARI ? 'inherit' : undefined, }, contentEditable: false, ref: callbackPlaceholderRef,