diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx
index 140a1e5eb..9afec8af1 100644
--- a/packages/slate-react/src/components/editable.tsx
+++ b/packages/slate-react/src/components/editable.tsx
@@ -521,6 +521,8 @@ export const Editable = (props: EditableProps) => {
suppressContentEditableWarning
ref={ref}
style={{
+ // Allow positioning relative to the editable element.
+ position: 'relative',
// Prevent the default outline styles.
outline: 'none',
// Preserve adjacent whitespace and new lines.
diff --git a/packages/slate-react/src/components/leaf.tsx b/packages/slate-react/src/components/leaf.tsx
index 417ea797b..21e064af8 100644
--- a/packages/slate-react/src/components/leaf.tsx
+++ b/packages/slate-react/src/components/leaf.tsx
@@ -1,4 +1,4 @@
-import React from 'react'
+import React, { useRef, useEffect } from 'react'
import { Element, Text } from 'slate'
import String from './string'
import { PLACEHOLDER_SYMBOL } from '../utils/weak-maps'
@@ -23,6 +23,25 @@ const Leaf = (props: {
renderLeaf = (props: RenderLeafProps) => ,
} = props
+ const placeholderRef = useRef(null)
+
+ useEffect(() => {
+ const placeholderEl = placeholderRef?.current
+ const editorEl = document.querySelector(
+ '[data-slate-editor="true"]'
+ )
+
+ if (!placeholderEl || !editorEl) {
+ return
+ }
+
+ editorEl.style.minHeight = `${placeholderEl.clientHeight}px`
+
+ return () => {
+ editorEl.style.minHeight = 'auto'
+ }
+ }, [placeholderRef])
+
let children = (
)
@@ -31,11 +50,12 @@ const Leaf = (props: {
children = (
{leaf.placeholder}