Bug 246029

Summary: Text selection sometimes jumps back to original position on tap to change text selection
Product: WebKit Reporter: mkuo
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: megan_gardner, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   
Attachments:
Description Flags
Minimal repro none

mkuo
Reported 2022-10-04 10:41:33 PDT
Created attachment 462793 [details] Minimal repro Overview: In contenteditable div or textarea, sometimes when I try to move the text selection by tapping on text, the selection changes to position that I tapped, but then jumps back to the previous position. Steps to reproduce:
Attachments
Minimal repro (249 bytes, text/plain)
2022-10-04 10:41 PDT, mkuo
no flags
mkuo
Comment 1 2022-10-04 10:50:53 PDT
Steps to reproduce: 1. Open attached minimal repro in Safari iOS 2. Tap after a word, like after "the" 3. Then tap before the word 4. (If issue doesn't reproduce on first try, try repeating steps 2/3) Actual results: Sometimes, when tapping to change the text selection, the selection will change for a split second then jump back to the original position. I used Web Inspector to add an event listener on "selectionchange" events document.addEventListener('selectionchange', () => console.log(document.getSelection())) and saw that whenever the issue reproduces, one tap causes two "selectionchange" events (the first to the tapped position, the second back to the previous position). This *seems* to reproduce more frequently when the selection menu (menu with options to select/select all) is visible. Expected results: Tap to change the text selection changes the text selection to the position that was tapped. Browser/Hardware Safari on iPhone 13 mini on iOS 16.0.2
Radar WebKit Bug Importer
Comment 2 2022-10-11 10:42:18 PDT
Note You need to log in before you can comment on or make changes to this bug.