slate
slate copied to clipboard
findEventRange in shadow-DOM: "Cannot resolve a Slate point from DOM point", in Chrome
Description I have an editor in a shadow-dom root. When using onMouseDown and calling findEventRange with the associated event an "Cannot resolve a Slate point from DOM point" is thrown, when Chrome. I have tried in firefox, confirming that it works.
Recording
Sandbox https://codesandbox.io/s/sweet-wilson-u19ved?file=/src/App.tsx:738-752
Steps To reproduce the behavior:
- Go to sandbox
- Click on the text in the editor
- See error
Expectation Not throwing when in shadow-dom.
Environment
- Slate Version: 0.82.1
- Operating System: osx
- Browser: Chrome
Context I found that findEventRange, calls document.caretRangeFromPoint in chrome, but I suspect that it gives misleading results in chrome.
https://crbug.com/388976#c34 Looks like caretRangeFromPoint
doesn't work in ShadowDOM.