Skip to content

[Bug]: Terminal programs requesting DEC 1004 receive no focus reports #37065

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web (also used by desktop)

Steps to reproduce

  1. Open a thread's terminal drawer.
  2. Run stty -echo -icanon; printf '\033[?1004h'; cat -v to request focus reporting.
  3. Click the chat composer, then focus the terminal again.
  4. Press Ctrl+C, then run printf '\033[?1004l'; stty sane to restore the terminal.

Expected behavior

The program receives ESC[O when the terminal loses focus and ESC[I when it gains focus. Disabling DEC 1004 stops these reports.

Actual behavior

No focus reports reach the program. The Ghostty surface updates cursor visuals without sending focus events to the PTY. Programs requesting focus reporting cannot react to focus changes. This regressed during the xterm.js to Ghostty migration.

Impact

Minor bug or occasional failure. Affects programs explicitly enabling DECSET 1004; no incidence estimate.

Version or commit

main @ b1050d3

Environment

Linux, Chromium, isolated development web app. Desktop shares the web terminal implementation. Mobile uses separate native implementations and is outside this fix.

Logs or stack traces

The focused real-WASM surface test expects ["\u001b[I", "\u001b[O"] and receives [] on main. A real-app scenario confirms mode 1004 through DECRQM before testing PTY bytes.

Screenshots, recordings, or supporting files

Fix PR contains the base-versus-head scenario proof and captures.

Workaround

None established.

Activity

  1. added
    vouch:trusted
    on Nov 15, 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

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions