fix(ios): keep the runner session when keyboard return finds nothing focused

OK
9h ago
+112-25

Summary

keyboard enter with nothing focused failed as XCTEST_RECORDED_FAILURE and invalidated the iOS runner session. When the return key is not hittable, the runner falls back to app.typeText(return). With no focus, XCTest records an issue ("Neither element nor any descendant has keyboard focus") rather than throwing, so the ObjC exception catcher never saw it.

The fallback typing now runs with its XCTest issues held back (a new holdingRecordedIssues, which shares the existing text-input-probe scope):

  • The no-focus refusal reads as "not pressed". The single-text-input fallback gets its turn; otherwise the command fails as UNSUPPORTED_OPERATION.
  • Every other issue (tap failures, timeouts, app not running, muted kAXError noise) is recorded through record(_:) as before, even when the batch also contains the refusal.
  • The single-input fallback taps the input, then types through app.typeText. Before, it typed into an index-bound element that the raised keyboard re-pointed at its own window, so it never submitted.
  • The containment log tag is now RECORDED_ISSUE_HELD.

3 files. Seen in react-native-pager-view CI (issue-1096-keyboard-shrink.e2e.ts, 3 failures).

Validation

  • Tested SHA da54017da: pnpm check:affected --run --head HEAD passed, exactCommit=true.
  • Runner XCTests at da54017da, local (build:xcuitest:ios with unit tests, arm64, iOS 26.5 sim). These all pass:
    • one input, submit fires (testKeyboardReturnWithNothingFocusedSubmitsTheSoleTextInput)
    • zero inputs, UNSUPPORTED_OPERATION (...AndNoTextInputFailsWithoutInvalidatingTheRunnerSession)
    • the classifier test
    • the existing testTextInputProbe* tests
  • Live CLI, one runner:
    • The runner fixture with one unfocused field (submit clears it): ok, and the field is cleared.
    • The pager-view home screen (no inputs): UNSUPPORTED_OPERATION, and the follow-up snapshot works.
    • 1 runner startup, 0 xctest_recorded_failure.
  • Pager-view issue-1096 (focused Enter): 3/3 pass.
  • Details: https://github.com/callstack/agent-device/pull/4032#issuecomment-6481712767