Skip to content

iOS: fill() on a React Native secureTextEntry field next to a show/hide toggle fails with "No focused text input" and presses the toggle (follow-up to #872) #1631

Closed

Description

@Wojtas399

Summary

On an iOS simulator, fill() into a React Native secureTextEntry field fails with ENGINE_FAILURE: perform fill failed: No focused text input was available for typing. It fails the same way with a credential password and with a plain string. After the failure, the field's show/hide toggle has been pressed, so the field now shows plain text.

This is the second half of #872. The bullet-only verification error that #872 reported is gone for us, but the toggle press that #872 also noted still happens, and fill now fails before verification. type_secret in agent.act goes through the same fill, so a password sign-in on iOS can't succeed. A model-driven step then makes it worse: it falls back to tapping "Show password", after which type_secret is refused with POLICY_DENIED because the field is no longer a password field.

pressSequentially() on the same field works, and the field stays secure.

Environment

  • e2e 0.23.0, @e2e-dev/mobile 0.12.6, agent-device 0.21.36 (also reproduced with plain agent-device 0.21.37-nightly.20261108.152)
  • iOS 27.0 and iOS 26.3 simulators (iPhone 17 Pro), Xcode 27.1, macOS
  • React Native 0.86.3, Expo SDK 57, Release build for the simulator

Reproduction

The password field is a standard TextInput in a row, with the toggle as a sibling to its right:

<View style={{ flexDirection: 'row', alignItems: 'center' }}>
  <TextInput style={{ flex: 1 }} placeholder="••••••••" secureTextEntry={!visible} />
  <View style={{ paddingRight: 16 }}>
    <TouchableOpacity
      accessibilityRole="button"
      accessibilityLabel={visible ? 'Ukryj hasło' : 'Pokaż hasło'} // Hide / Show password
      onPress={() => setVisible(v => !v)}
      hitSlop={8}
    >
      <Ionicons name={visible ? 'eye-off' : 'eye'} size={20} />
    </TouchableOpacity>
  </View>
</View>

The tree reports the field correctly as secure. From agent-device's snapshot:

TextField        "you@example.com"  rect x21 y365 w360 h19   editable, password:false
SecureTextField  "••••••••"         rect x21 y449 w324 h19   editable, password:true
Button "Pokaż hasło"                rect x345 y448 w20 h21

Test, from a signed-out start (app.clearState() + device.clearKeychain()), with no agent steps:

test('A: fill', async ({ screen }) => {
  const user = credentials.user('athlete');
  await screen.getByPlaceholder('you@example.com').fill(user.username);   // ok
  await screen.getByPlaceholder('••••••••').fill(user.password);          // fails
});

test('B: pressSequentially', async ({ screen }) => {
  const user = credentials.user('athlete');
  await screen.getByPlaceholder('you@example.com').fill(user.username);
  await screen.getByPlaceholder('••••••••').pressSequentially(process.env.E2E_USER_ATHLETE_PASSWORD ?? '');
  await expect(screen.getByLabel('Pokaż hasło')).toBeVisible();           // still secure
  await screen.getByText(/^Zaloguj się$/).last().tap();
  await expect(screen.getByText('Dziś i jutro')).toBeVisible({ timeout: 30_000 }); // signed in
});
× A: fill  16.98s
  → ENGINE_FAILURE: perform fill failed: No focused text input was available for typing.
✓ B: pressSequentially  16.28s

A's sign-in tap and Home check are left out here, since it never gets that far. A plain string also fails when passed to agent-device's own fill (below), so it isn't specific to secrets.

The same thing happens with plain agent-device, outside e2e:

agent-device fill @e6 "probe@example.com"   # email: "Filled 17 chars"
agent-device fill @e8 "dummy-pass-123"      # secure field: TEXT_INPUT_NOT_FOCUSED
agent-device snapshot -i
# @e8 [text-field] "••••••••" [focused] [editable]   <- was [securetextfield]
# @e9 [button] "Ukryj hasło"                          <- toggle got pressed

# fresh launch:
agent-device press @e8
agent-device type "dummy-pass-123"          # "Typed 14 chars", field stays [securetextfield]

Runner log for the failing fill:

AGENT_DEVICE_RUNNER_TEXT_ENTRY_FOCUS evidence=input-reports-keyboard-focus polls=1
... phase=focus durationMs=845.3 chars=14 mode=replacement
... phase=initial-resolve durationMs=0.0 chars=14 mode=replacement
... phase=clear durationMs=2972.5 chars=14 mode=replacement
(then TEXT_INPUT_NOT_FOCUSED)

What we think happens

This is inferred from the log and the screen, not checked in the runner source.

Focus succeeds, and the failure follows the ~3 s clear phase of replacement mode. iOS blocks select-all on secure fields, so the clear probably falls back to a caret tap near the field's trailing edge (x ≈ 345). The toggle starts at x = 345, and with hitSlop={8} it reaches into the field, so the tap lands on the toggle. The app flips secureTextEntry, React Native swaps the native input, and the input the runner was holding focus on is gone, hence TEXT_INPUT_NOT_FOCUSED. pressSequentially (focus + keyboard.type) never clears, which is why it works.

Expected

fill() with a credential password or a plain string enters the text into a secure field, the field stays secure, and no control next to the field is pressed.

Possible directions:

  • Skip the clear phase when the field is empty (it shows only its placeholder, or the tree reports no value).
  • For a password: true field, clear with a bounded run of deletes instead of select-all plus a caret tap.
  • Keep any fallback caret tap inside the field's rect, inset from the edges, so it can't hit a neighbouring control.

Workaround

pressSequentially() with the password as a plain string works. But it refuses a Secret, so the password loses redaction and can't be used through credentials or in agent.act. If pressSequentially could accept a Secret for a password field, that would also unblock this.

Activity

  1. okwasniewski commented on Nov 8, 2026

    @okwasniewski
    Member

    Automated review.

    Thanks for the detailed repro. Your read is right, confirmed against the agent-device 0.21.36 runner source:

    • clearTextInput (RunnerTests+TextEntry.swift) treats every .secureTextField value as unreadable, so it never sees the field as empty and runs the clear even on the first fill of an empty field.
    • The clear starts with moveCaretToEnd, a tap at frame.minX + frame.width - 4. With the toggle at x=345 and hitSlop={8}, that tap lands on "Pokaż hasło", RN swaps the native input, and the held focus is gone -> TEXT_INPUT_NOT_FOCUSED.
    • pressSequentially skips the clear, which is why it works.

    The fix belongs in the agent-device runner: treat an empty secure field (placeholder or nil value) as empty, clear secure fields with a delete burst first, and only fall back to the caret tap if text remains. e2e side (nodes.ts, type_secret, redaction) needs no change. We'll track it here and bump the pin once the runner fix ships.

    Workaround until then: pressSequentially on the password field (loses Secret redaction, as you noted).

  2. added
    bugSomething isn't working
    mobileMobile engine (@e2e-dev/mobile)
    agent-deviceRoot cause in agent-device, fixed upstream then bumped here
    P1Required for v0
    on Nov 8, 2026
  3. TanmayOG commented on Nov 9, 2026

    @TanmayOG

    @okwasniewski This is still on agent-device main. Its iOS runner hasn't changed since the 20261108 nightly in the report.

    Can I take this up in agent-device?

  4. okwasniewski commented on Nov 9, 2026

    @okwasniewski
    Member

    Automated review.

    @TanmayOG yes please, the fix belongs in agent-device's iOS runner. Nothing to change on the e2e side. Link the agent-device PR here.

    What we found when we probed it (iOS 26.5 sim, RN 0.86):

    • RN secureTextEntry is always a .secureTextField while secure, whatever the other props.
    • An empty secure field reads its value as nil or the placeholder. A filled one reads one bullet per character. So "empty" is detectable, and clearTextInput can skip the clear on the first fill.
    • After focus, one delete clears a secure field. So the clear can be a delete burst first, with the moveCaretToEnd edge tap only if the field still holds text.
    • Please add a runner test with a toggle at the trailing edge that fails today (toggle pressed) and passes with the fix.

    Once it ships in an agent-device release we bump the pin in @e2e-dev/mobile.

  5. TanmayOG commented on Nov 10, 2026

    @TanmayOG
  6. Wojtas399 commented on Nov 13, 2026

    @Wojtas399
    Author

    Confirmed fixed on @e2e-dev/mobile 0.12.7 (agent-device 0.21.37).

    My sign-in helper is back to fill() on the RN secureTextEntry password field with the show/hide toggle, using the password credential, and the pressSequentially workaround is gone. The full suite passes locally on both the iOS simulator and the Android emulator. No more "No focused text input", and the toggle no longer gets pressed.

    Thanks @TanmayOG for the fix (callstack/agent-device#4350) and @okwasniewski for the triage. Fine to close from my side.

  7. okwasniewski commented on Nov 16, 2026

    @okwasniewski
    Member

    Closing: confirmed fixed by the reporter on @e2e-dev/mobile 0.12.7 (agent-device 0.21.37, callstack/agent-device#4350). Thanks @TanmayOG and @Wojtas399.

    Automated triage by Claude Code on behalf of the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Required for v0agent-deviceRoot cause in agent-device, fixed upstream then bumped herebugSomething isn't workingmobileMobile engine (@e2e-dev/mobile)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions