Bug 213298

Summary: Insertion point is missing after focusing a text field that has been emptied
Product: WebKit Reporter: mitz
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: cdumez, jond, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Unspecified   
OS: Unspecified   
URL: data:text/html,<input%20value=0%20autofocus>

mitz
Reported 2020-06-17 09:04:42 PDT
To reproduce this bug: 1. In Safari, navigate to the URL 2. Press Delete to delete the contents of the text field 3. Press Tab to move focus away from the text field 4. Press Tab again to focus the text field Result: After step 2, the field is focused and empty with a blinking insertion point. After step 4, the field is focused and empty but the insertion point is missing.
Attachments
mitz
Comment 1 2020-06-17 09:07:27 PDT
Maybe focusing the empty field makes an empty selection in it (as normally focusing a field selects the entire contents) that is somehow different from a caret selection.
mitz
Comment 2 2020-06-17 09:09:43 PDT
Doesn’t happen if the text field never contained anything (the apparent difference being the presence or lack of a <br> in the shadow DOM).
Wenson Hsieh
Comment 3 2020-06-17 09:16:35 PDT
I'm able to repro. Some debug logging in FrameSelection::setSelectionWithoutUpdatingAppearance... After deleting: OLD: { OffsetInAnchor(<DIV 0x11dc9e2f0 id='' class=''>, 0) } NEW: { BeforeAnchor(<BR 0x11dc9f380 id='' class=''>) } After tabbing to the unified field: OLD: { BeforeAnchor(<BR 0x11dc9f380 id='' class=''>) } NEW: { None } After tabbing back to the text field: OLD: { None } NEW: { BeforeAnchor(<BR 0x11dc9f380 id='' class=''>), AfterAnchor(<BR 0x11dc9f380 id='' class=''>) }
Radar WebKit Bug Importer
Comment 4 2020-06-17 09:16:48 PDT
Wenson Hsieh
Comment 5 2020-06-17 09:19:24 PDT
Also reproduces on stock Safari in macOS 10.15.6
Note You need to log in before you can comment on or make changes to this bug.