{"record":{"id":"a08aaf67342dcbd8","repo":"ianstormtaylor/slate","slug":"cannot-resolve-a-dom-point-from-slate-point-scr","errorCode":null,"errorMessage":"Cannot resolve a DOM point from Slate point: ${Scrubber.stringify(point)}","messagePattern":"Cannot resolve a DOM point from Slate point: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slate-dom/src/plugin/dom-editor.ts","lineNumber":638,"sourceCode":"          // selection to return incorrect zero values (https://bugs.chromium.org/p/chromium/issues/detail?id=435438)\n          // which will cause issues when scrolling to it.\n          domText instanceof DOMText ? domText : nextText,\n          nextText.textContent?.startsWith('\\uFEFF') ? 1 : 0,\n        ]\n        break\n      }\n\n      if (point.offset <= end) {\n        const offset = Math.min(length, Math.max(0, point.offset - start))\n        domPoint = [domNode, offset]\n        break\n      }\n\n      start = end\n    }\n\n    if (!domPoint) {\n      throw new Error(\n        `Cannot resolve a DOM point from Slate point: ${Scrubber.stringify(\n          point\n        )}`\n      )\n    }\n\n    return domPoint\n  },\n\n  toDOMRange: (editor, range) => {\n    const { anchor, focus } = range\n    const isBackward = Range.isBackward(range)\n    const domAnchor = DOMEditor.toDOMPoint(editor, anchor)\n    const domFocus = Range.isCollapsed(range)\n      ? domAnchor\n      : DOMEditor.toDOMPoint(editor, focus)\n\n    const window = DOMEditor.getWindow(editor)","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/ianstormtaylor/slate/blob/72a37c701e5da4bb13a305d416d9c070d19d3a45/packages/slate-dom/src/plugin/dom-editor.ts#L620-L656","documentation":"Thrown by DOMEditor.toDOMPoint when no DOM text node and offset can be found corresponding to a Slate point. This happens when the point references text that has no rendered DOM counterpart, or the point is out of bounds after the document changed.","triggerScenarios":"Calling toDOMPoint with a point whose path no longer exists, an offset past the end of a text node, a point in a node rendered by a placeholder (e.g. virtualized), or while the DOM is mid-flush.","commonSituations":"Restoring a saved selection after the document was normalized/changed; scrolling virtualized content so the text is unmounted; racing selection restoration against React commits.","solutions":["Validate the point with Editor.has(editor, point) (or Node.has on the path) before converting","Recompute the selection after edits rather than reusing stale points","Defer conversion until after render commits","Ensure the node is actually rendered (not virtualized away) before asking for its DOM point"],"exampleFix":"// before\nconst domPoint = DOMEditor.toDOMPoint(editor, savedPoint)\n// after\nconst p = savedPoint\nif (Editor.has(editor, p)) {\n  const domPoint = DOMEditor.toDOMPoint(editor, p)\n}","handlingStrategy":"validation","validationCode":"import { Editor } from 'slate'\nif (Editor.has(editor, point)) {\n  const domPoint = DOMEditor.toDOMPoint(editor, point)\n}","typeGuard":"const isPointInEditor = (editor: Editor, p: Point): boolean => {\n  try { return Editor.has(editor, p) } catch { return false }\n}","tryCatchPattern":"try { DOMEditor.toDOMPoint(editor, point) } catch (e) { if (/Cannot resolve a DOM point/.test(e.message)) recompute selection; else throw e }","preventionTips":["Validate points with Editor.has before DOM conversion","Recompute selections after normalization instead of reusing saved ones","Ensure referenced text is actually rendered"],"tags":["slate","selection","dom-point","stale-reference"],"backgroundTag":"stale-selection-point","analyzedSha":"72a37c701e5da4bb13a305d416d9c070d19d3a45","analyzedAt":"2026-08-27T23:04:51.145Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}