- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
Labels
Description
Lexical version: 0.31.2
Steps To Reproduce
- Clone repository.
 - Run pnpm install & pnpm dev.
 - Visit dev site.
 - Input 
aaaaa\naa. - Input offset=6 and click "Set Offset".
 
Link to code example:
https://github.com/wataru-chocola/lexical-offset-bug
The current behavior
You will see the following error in devtools console.
client:789 [vite] connecting...
client:912 [vite] connected.
hook.js:608 IndexSizeError: Failed to execute 'setBaseAndExtent' on 'Selection': There is no child at offset 6.
    at setDOMSelectionBaseAndExtent (Lexical.dev.mjs:7321:18)
    at updateDOMSelection (Lexical.dev.mjs:7407:3)
    at $commitPendingUpdates (Lexical.dev.mjs:8078:9)
    at Lexical.dev.mjs:8347:9
overrideMethod @ hook.js:608
setDOMSelectionBaseAndExtent @ Lexical.dev.mjs:7327
updateDOMSelection @ Lexical.dev.mjs:7407
$commitPendingUpdates @ Lexical.dev.mjs:8078
(anonymous) @ Lexical.dev.mjs:8347
localhost/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
offsetView.createSelectionFromOffsets makes invalid selection if specified offset points to inline node.
- anchor / focus node will be its parent 
element(correct). - anchor / focus offset will be the offset of the inline node, but should be the index of the inline node in the parent.
 
The expected behavior
No error occurs.
