ianstormtaylor/slate · error · Error
Cannot resolve a Slate point from DOM point: ${domPoint}
Error message
Cannot resolve a Slate point from DOM point: ${domPoint} What it means
Thrown by DOMEditor.toSlatePoint when the DOM point cannot be mapped to a Slate text node — typically when the DOM node under the point is not a Slate text leaf (or the closest slate leaf lookup fails) and suppressThrow is not enabled.
Source
Thrown at packages/slate-dom/src/plugin/dom-editor.ts:915
return null as T extends true ? Point | null : Point
}
throw e
}
let { path, offset } = Editor.start(editor, nodePath)
if (!node.querySelector('[data-slate-leaf]')) {
offset = nearestOffset
}
return { path, offset } as T extends true ? Point | null : Point
}
}
if (!textNode) {
if (suppressThrow) {
return null as T extends true ? Point | null : Point
}
throw new Error(
`Cannot resolve a Slate point from DOM point: ${domPoint}`
)
}
// COMPAT: If someone is clicking from one Slate editor into another,
// the select event fires twice, once for the old editor's `element`
// first, and then afterwards for the correct `element`. (2017/03/03)
let slateNode
try {
slateNode = DOMEditor.toSlateNode(editor, textNode!)
} catch (e) {
if (suppressThrow) {
return null as T extends true ? Point | null : Point
}
throw e
}
let path
try {View on GitHub (pinned to 72a37c701e)
Solutions
- Pass suppressThrow: true and handle the null return
- Use DOMEditor.toSlateRange with suppressThrow for whole-selection reads
- Clamp DOM points into the editable before converting
- For void nodes, resolve selection to the void node's edge instead of its inner DOM
Example fix
// before
const p = DOMEditor.toSlatePoint(editor, domPoint, { suppressThrow: false })
// after
const p = DOMEditor.toSlatePoint(editor, domPoint, { suppressThrow: true })
if (p == null) return Defensive patterns
Strategy: fallback
Validate before calling
const p = DOMEditor.toSlatePoint(editor, domPoint, { suppressThrow: true })
if (p == null) { /* handle non-mappable point (void, boundary) */ } Type guard
null
Try / catch
try { DOMEditor.toSlatePoint(editor, domPoint, { suppressThrow: false }) } catch (e) { if (/Cannot resolve a Slate point/.test(e.message)) return null; else throw e } Prevention
- Prefer suppressThrow: true when reading arbitrary DOM points
- Clamp selections to the editable before conversion
- Handle void-node selections at the node edge, not inner DOM
When it happens
Trigger: Calling toSlatePoint on a DOM point inside a void element's spacer, an element boundary between nodes, or DOM produced by another editor; also cross-editor clicks where the old editor resolves a point targeting the new editor's DOM.
Common situations: Selection/drop handlers that read window.getSelection() when it briefly sits on non-Slate DOM (void spacers, padding elements), or programmatic selections created with Range APIs that don't align to Slate leaves.
Related errors
- Cannot resolve a DOM point from Slate point: ${Scrubber.stri
- Cannot resolve a Slate range from a DOM event: ${event}
- Cannot resolve a Slate range from DOM range: ${domRange}
- The <selection> hyperscript tag must have an <anchor> tag as
- The <selection> hyperscript tag must have a <focus> tag as a
AI-assisted analysis of ianstormtaylor/slate@72a37c701e (2026-08-27).
Data as JSON: /api/errors/dd4bc43de7a1c1d7.
Report an issue: GitHub.