Skip to content

Aggressive Input Auto-focus prevents scrolling and interacting with Terminal #9023

Closed

Description

@shrk7x

I'm experiencing a UX issue where the chat input box aggressively grabs focus, making it difficult to interact with the Terminal output.

Problem:
When I try to scroll the terminal output (to view previous command logs), the focus is forcibly pulled back to the chat input box. This causes the scroll action (or "Arrow Up" key if mapped) to trigger the "History Navigation" of the chat input (showing the previous sent message) instead of scrolling the terminal buffer.

Observations:

  1. It seems prompt-input.tsx has a createEffect that calls editorRef.focus() aggressively.
  2. session.tsx adds a global keydown listener that might be redirecting focus back to the input unless the active element has data-prevent-autofocus.
  3. Even when clicking inside the Terminal component (which has data-prevent-autofocus), the focus often snaps back to the input, possibly because the actual active element (e.g., the canvas or an inner div of ghostty-web) is not being correctly identified as "protected".

Expected Behavior:
When I click or scroll in the Terminal area, the focus should stay in the Terminal so I can scroll up/down and copy text without being interrupted. The Input box should only grab focus when I explicitly click it or start typing in a neutral context.

Environment:

  • OS: macOS
  • Browser/App: OpenCode Desktop App
  • Terminal: iTerm2 (where OpenCode is running) / Internal OpenCode Terminal

Please relax the auto-focus logic to allow the Terminal to retain focus.

Activity

  1. github-actions commented on Jan 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. shrk7x commented on Jan 17, 2026

    @shrk7x
    Author

    This is the same issue #6209

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

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions