Skip to content

macOS engine: type_text sends a Tab or a single-line Return after text it could not read back (both routes) #426

Open

Description

@SSFSKIM

Problem

type_text presses a Tab, or a Return in a single-line field, only once the text before it reads back: #354's checkpoint. That checkpoint runs only when the read-back has a plan. When the snapshot can't read the field, there is nothing to check against, so the key goes out at once and the checkpoint does nothing (beforeUnit returns immediately). Two cases where the field can't be read:

  • the AX value is capped;
  • the selected range can't be read.

So type_text("query\n") into such a field sends the Return even if the app ignored or rewrote the text before it, and that Return can submit a form. Only the final answer, typeUnconfirmed, says anything went wrong, and by then the form may have been submitted.

It happens on both routes:

Found by #361's independent review (finding 2). The keyed route's behaviour was confirmed while building #361's fix.

What to do

Decide for both routes together. Options:

  1. Withhold a key that may submit after text that can't be verified. Answer typeUnconfirmed with "the Return was not sent", and give its count of what was entered. The cost is real: in such fields a typed newline would never submit, even when the text landed.
  2. Keep sending, and say so. Make the docs explicit that in a field that can't be read, a Tab or a Return goes out without a check.
  3. A middle course: withhold only where neither the read-back nor some weaker target-side evidence saw the text land. The paste route already has such evidence (Fix Chrome background paste clipboard-read timeouts in composing@textedit rows #187's effect); the keyed route would need a cheap equivalent, such as a count or caret change.

Check

Stub tests on both routes, for a single-line field whose value is capped and one whose range can't be read:

  • text followed by a newline;
  • the app ignoring the text.

The chosen behaviour holds on both routes, and the docs state it.

Spawned by #361.

Activity

  1. added
    bug
    status:ready-for-implementer
    priority:P3
    on Nov 19, 2026
  2. added 2 commits that reference this issue on Nov 19, 2026
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

    bugpriority:P3status:ready-for-implementer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions