Skip to content

fix(elements): block Enter submit while streaming in PromptInputTextarea#449

Open
mmaxence wants to merge 1 commit into
vercel:mainfrom
mmaxence:fix/prompt-input-enter-guard-streaming
Open

fix(elements): block Enter submit while streaming in PromptInputTextarea#449
mmaxence wants to merge 1 commit into
vercel:mainfrom
mmaxence:fix/prompt-input-enter-guard-streaming

Conversation

@mmaxence

Copy link
Copy Markdown

Fixes #439

While streaming with an onStop handler, PromptInputSubmit renders as type="button", so the Enter guard in PromptInputTextarea finds no button[type="submit"] and submitButton?.disabled evaluates to undefined: the form submits mid-stream. This applies the guard proposed in the issue: no submit button in the form blocks Enter, same as a disabled one.

This also answers the behaviour question raised in the issue thread: a composable PromptInput without PromptInputSubmit no longer submits on Enter. The form has no submit control to consult, and submitting with unknown status is the unsafe default. Both behaviours are pinned in prompt-input.test.tsx.

All 952 package tests pass.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@mmaxence is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enter key submits form during streaming because querySelector('button[type="submit"]') returns null

1 participant