Skip to content

Bug: Paste + Enter causes text to disappear without sending #31246

Closed as not planned

Description

@madson-dev-br

Description

When pasting text into the chat input and pressing Enter, the pasted text disappears instead of being sent. Typing normally (without pasting) works fine.

Steps to Reproduce

  1. Copy any text
  2. Paste it into the chat input
  3. Press Enter immediately after pasting
  4. The text vanishes

Root Cause

contenteditable div race condition: paste event and keydown (Enter) fire in parallel, DOM not updated yet when Enter checks for content, submit aborted.

Environment

-OpenCode 1.16.2 (npm: opencode-ai)
-Kubuntu Linux, KDE Konsole

Suggested Fix

-Read DOM directly on Enter instead of stale state
-Add isPasting flag
-Use requestAnimationFrame before content check

[Full report: /tmp/opencode_bug_report.md]

Activity

  1. github-actions commented on Jun 7, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (specifically triggered by pressing Enter immediately after paste, rather than typing after paste), please add a note clarifying the difference so maintainers can track it separately.

  2. opencode-agent commented on Jul 20, 2026

    @opencode-agent
    Contributor

    This may be fixed in v1.18.4 by #37483, which changed paste handling to synchronously insert plain text and update prompt state. Could you test on v1.18.4 and confirm whether paste followed immediately by Enter now sends correctly?

  3. github-actions commented on Sep 19, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions