Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Browser surface
Yes
Summary
When 2 tables exist one below the other in an editor with no empty block between them, clicking away within the editor(somewhere beside the first table) causes the table call to lose focus, and subsequent typing causes content to render below the 1st table, with a console error
Public reproduction URL
https://platejs.org/docs/table
Steps to reproduce
Refer #4952
On https://platejs.org/docs/table (or any editor built from the docs demo with or without TableKit):
- Insert two tables (or one table followed by no trailing paragraph).
- Put the caret in a cell and type a few characters.
- Click in the gap between the two tables (or just below the last table). Note the caret disappears visually — editor.selection did not update because the click target has no data-slate-node ancestor.
- Type text. The text is inserted into the last cell (where the caret was) rather than where you clicked, because editor.selection is stale.
- Click outside again, type again. Repeat.
- After a few iterations, native contentEditable insertion ends up in the unmapped DOM region (visible text appears below the table with no Slate block backing it), and the next interaction throws:
- Error: Cannot resolve a Slate point from DOM point: [object HTMLDivElement],
Variant (paste-only, no repeated typing needed):
3a. After step 3 above, press Ctrl+V with anything rich in the clipboard (e.g. a previously copied paragraph or cell from within the editor).
Observed: immediate throw of the same error.
Expected behavior
licks inside the editor should always produce a valid editor.selection, either by ensuring a clickable Slate-mapped region exists for every reachable pixel (e.g., a trailing paragraph after the last table + inter-table paragraph normalization in the table plugin), or by toSlateRange never throwing on user-interaction paths (returning null and falling through).
Nice-to-have: when a click lands outside any table (in an unmapped region of the editor), the selection could be snapped to the last cell of the nearest table — the same behavior that already happens when only a single table is present. With a single table, clicking below/outside the table keeps focus in the table's last cell; with multiple tables, that fallback is lost and focus/selection disappears entirely.
Actual behavior
The current behavior is that a single stray click inside the editor can put the editor in an unrecoverable state, and render subsequent user input in unexpected locations.
Acceptance criteria
Clicks inside the editor should always produce a valid editor.selection, either by ensuring a clickable Slate-mapped region exists for every reachable pixel (e.g., a trailing paragraph after the last table + inter-table paragraph normalization in the table plugin), or by toSlateRange never throwing on user-interaction paths (returning null and falling through).
Plate / Slate / React versions
"platejs": "^52.0.17",
"slate": "^0.103.0",
"slate-hyperscript": "^0.100.0",
"react": "^18.3.0",Operating system
Latest mac, ubuntu and windows
Install method
No response
Framework / app setup
Plain react
Affected packages or entry points
"@platejs/table": "^52.0.11",
Minimal code or config excerpt
NOT_ENOUGH_INFOLogs, screenshots, and evidence
Screenshots
Refer https://github.com/udecode/plate/discussions/4952#:~:text=0.120.0-,Screenshots,-The%20ccsc%20text
Logs
Uncaught Error: Cannot resolve a Slate point from DOM point: [object HTMLDivElement],2
at Object.toSlatePoint (index.es.js)
at Object.toSlateRange (index.es.js)
at HTMLDivElement. (index.es.js)Impact and severity
No response
Additional information
No response
Activity
dosubot commentedon Apr 24, 2026
This was already discussed in detail in Discussion #4952 — the root cause is that
slate-react'sonDOMBeforeInputhandler has twotoSlateRangecalls usingsuppressThrow: false. When a click lands on an unmapped DOM region (nodata-slate-nodeancestor), the DOM selection drifts buteditor.selectionstays stale. The next typing or paste event hits those calls and throws.Plate's own
toSlateRangewrapper does suppress errors [1], but these event handlers inslate-reactcallReactEditor.toSlateRangedirectly, bypassing it.The table plugin's normalization [2] currently does not ensure paragraphs between adjacent tables or after the last table — that's delegated to
TrailingBlockPlugin[3], which only covers the document's last node.Two fixes are needed:
In
slate-react: The two unsafetoSlateRangecalls inonDOMBeforeInputshould usesuppressThrow: trueor be wrapped in try/catch, consistent with the other calls in the same file that already do this [4].In the table plugin:
withNormalizeTablecould ensure a mapped block exists between adjacent tables, so there's always a valid click target in those gaps.As a partial workaround, adding
TrailingBlockPluginto your setup ensures at least a trailing paragraph exists after the last table, reducing the frequency of the crash — but it won't prevent it for inter-table gaps or editor padding regions, as @caspersf noted.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
zbeyens commentedon Apr 25, 2026
✅ Fixed in #4967.
QA:
/docs/table.toSlateRange/Cannot resolve a Slate point from DOM pointerror appears.caspersf commentedon Apr 27, 2026
@zbeyens, just wanted to confirm if this has been deployed. I still see the issue in https://platejs.org/docs/table
zbeyens commentedon Apr 27, 2026
No, I'll close that PR. The fix is too dirty to be released. You could try it on your end.
filippodev-tech commentedon Jul 2, 2026
@zbeyens hi, I am having the same issue, after implementing the HTML setup.
My deps:
{ "dependencies": { "@platejs/basic-nodes": "^53.0.0", "@platejs/basic-styles": "^53.0.0", "@platejs/callout": "^53.0.0", "@platejs/caption": "^53.0.0", "@platejs/code-block": "^53.0.0", "@platejs/code-drawing": "^53.0.0", "@platejs/comment": "^53.0.0", "@platejs/date": "^53.0.0", "@platejs/footnote": "^53.0.0", "@platejs/layout": "^53.0.0", "@platejs/link": "^53.0.3", "@platejs/list": "^53.1.3", "@platejs/markdown": "^53.2.2", "@platejs/media": "^53.1.4", "@platejs/mention": "^53.0.0", "@platejs/suggestion": "^53.2.3", "@platejs/table": "^53.0.9", "@platejs/toc": "^53.0.0", "@platejs/toggle": "^53.0.0", "next": "^15.5.14", "platejs": "^53.2.1", }, "overrides": { "slate": "0.118.0", "slate-dom": "0.117.4", "slate-react": "0.117.1" } }and my plugins:
your help will be much appreciated
fix(table): insert trailing and inter-table paragraph blocks to preve…