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.
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.
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).
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=''>) }
<rdar://problem/64450787>
Also reproduces on stock Safari in macOS 10.15.6