"Cannot resolve from DOM point" error on onDomSelectionChange for readonly void elements
See original GitHub issueDescription If you click / select a void element when the editor is in readonly mode, it throws a “Cannot resolve from DOM point” error.
Recording
Sandbox https://codesandbox.io/s/slate-reproductions-forked-g486e7?file=/index.js
Steps To reproduce the behavior:
- Create a new type of element that’s void.
- Put your editor in reaadonly mode
- 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:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 😃
Ahh, yeah, we use
contentEditable=false
in our void elements, too, but we might just have copied that from the examples 😄