question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Cannot resolve from DOM point" error on onDomSelectionChange for readonly void elements

See original GitHub issue

Description If you click / select a void element when the editor is in readonly mode, it throws a “Cannot resolve from DOM point” error.

Recording

https://user-images.githubusercontent.com/48929123/158026541-719c5c25-dde7-495c-907b-ab5ae2748d79.mov

Sandbox https://codesandbox.io/s/slate-reproductions-forked-g486e7?file=/index.js

Steps To reproduce the behavior:

  1. Create a new type of element that’s void.
  2. Put your editor in reaadonly mode
  3. Click on the read only void element.

Expectation Shouldn’t crash.

Environment

  • Slate Version: [e.g. 0.71.0]
  • Slate React: 0.72.8
  • Operating System: [macOS]
  • Browser: [Firefox]

Context I have a local fix in draft - https://github.com/ianstormtaylor/slate/pull/4887 More context: I took the image example and tried to reproduce it here: https://codesandbox.io/s/slate-reproductions-forked-g486e7?file=/index.js. It doesn’t. The reason being that the image example has the contentEditable set to true. So I guess, the question then becomes, should all void elements set contentEditable to false?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
heyitsaamircommented, Mar 18, 2022

@cmmartin thank you! If that’s the case I’ll close this issue with that being the recommendation.

Also @ahoisl thanks for your help here 😃

0reactions
ahoislcommented, Mar 16, 2022

Thanks @ahoisl ! Seems like if we set contentEditable to false, then the problem goes away. (Added this in the original issue). I wonder if that’s the recommended approach then?

Ahh, yeah, we use contentEditable=false in our void elements, too, but we might just have copied that from the examples 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

slate-react - UNPKG
userAgent\n )\n\n// Check if DOM is available as React does internally. ... Point | null : Point\n }\n throw new Error(\n `Cannot resolve...
Read more >
Renovate Bot Package Diff
+ throw new Error('Unable to find a host window element for this editor'); ... if (!domPoint) {\n throw new Error(\n `Cannot resolve a...
Read more >
How to observe readonly properties of an HTMLElement in ...
The OP should give MutationObserver a try. For the OP's case a node's isConnected attribute can not be directly observed but the same ......
Read more >
Error: Cannot resolve a DOM point from Slate point
Now fully understanding the issue, I set out to figure out how to move the cursor to the beginning of the input before...
Read more >
input type=reset – reset button - HTML5
The input element with a type attribute whose value is " reset " represents a ... boolean checkValidity(); void setCustomValidity(DOMString error); readonly ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found