Skip to content

Commit d0d2cc3

Browse files
thymikeeclaude
authored andcommitted
fix(ios): don't clear an already-empty text field (fixes fill mis-navigation)
clearTextInput unconditionally ran moveCaretToEnd (an edge-tap computed from the element frame) + a 24-key delete burst, even when the field was empty. On a field that repositions on focus — e.g. the Settings search bar jumping bottom->top and revealing a 'Suggestions' list — that edge-tap used a stale frame and landed on an adjacent row (Developer), navigating away instead of clearing. fill (replace) into the search field went to the Developer pane (0/3 correct). Skip the clear entirely when the field's value is already empty (placeholder treated as empty): replacing into an empty field is a no-op, and skipping avoids the stray edge-tap. fill into the Settings search now types correctly and stays put: 5/5 exact (read-back + screenshot).
1 parent 2438e7e commit d0d2cc3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ extension RunnerTests {
316316
}
317317

318318
func clearTextInput(_ element: XCUIElement) {
319+
// Nothing to clear: skip both the delete burst and the moveCaretToEnd edge-tap. The
320+
// edge-tap computes a point from the element frame, which can be stale after the field
321+
// repositions on focus (e.g. the Settings search bar jumps bottom->top and reveals a
322+
// "Suggestions" list) — tapping there navigates away instead of clearing. Replacing into
323+
// an already-empty field is a no-op, so returning early is also semantically correct.
324+
let existing = editableTextValue(for: element, treatingPlaceholderAsEmpty: true) ?? ""
325+
if existing.isEmpty {
326+
return
327+
}
319328
#if !os(tvOS)
320329
moveCaretToEnd(element: element)
321330
#endif

0 commit comments

Comments
 (0)