Skip to content

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

Description

@madsonhsd-dev

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]

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