Bug 275185

Summary: Selection's .focusOffset can exceed the number of child nodes that .focusNode has
Product: WebKit Reporter: Han <laughinghan>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, karlcow, megan_gardner, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 14   
See Also: https://bugs.webkit.org/show_bug.cgi?id=251020

Han
Reported 2024-06-05 15:42:09 PDT
In both Safari 17 and the latest Safari Tech Preview, the selection's .focusOffset can exceed the number of child nodes that .focusNode has, if the cursor is at the top-level of a contentEditable and a child is removed in a `beforeinput` event handler: https://output.jsbin.com/wupuhef Possibly related? https://bugs.webkit.org/show_bug.cgi?id=251020
Attachments
Ahmad Saleem
Comment 1 2024-06-05 17:10:57 PDT
*** Firefox Nightly 128 *** focusOffset: 7 focusNode children: 7 focusOffset: 6 focusNode children: 6 focusOffset: 7 focusNode text length: 7 focusOffset: 6 focusNode text length: 6 *** Safari Technology Preview 196 *** focusOffset: 7 focusNode children: 7 focusOffset: 7 focusNode children: 6 <---- focusOffset focusOffset: 7 focusNode text length: 7 focusOffset: 6 focusNode text length: 6 *** Chrome Canary 127 *** focusOffset: 1 focusNode children: 0 focusOffset: 6 focusNode children: 6 focusOffset: 7 focusNode text length: 7 focusOffset: 6 focusNode text length: 6
Radar WebKit Bug Importer
Comment 2 2024-06-12 15:43:13 PDT
Note You need to log in before you can comment on or make changes to this bug.