Repository navigation
fix(button)!: default to type="button" - #144
Open
pratikbuilds wants to merge 3 commits into
Open
pratikbuilds wants to merge 3 commits into
pratikbuilds wants to merge 3 commits into
Conversation
TheGreatAxios
requested changes
Oct 30, 2026
TheGreatAxios
left a comment
Contributor
There was a problem hiding this comment.
Review · Request changes
Defaults native Button elements to type="button" when asChild is false so bare buttons inside host forms do not implicitly submit.
Findings
src/ui/button.tsx:80—type={asChild ? undefined : "button"}is placed before{...props}, so a caller or wrapper that forwards{ type: undefined }overwritestype="button"withundefinedand renders a submit button (<button data-slot="button" ...>). Could we destructuretype = asChild ? undefined : "button"inButton's parameters and passtype={type}sotype={undefined}still defaults to"button"?src/ui/button.test.tsx:30(informational) —container.querySelector("button") as HTMLButtonElement(and lines 44, 62) usesasto silence| nullrather than narrowing.
Button rendered a native <button> with no type, so HTML treated every bare Button as a submit button: inside a host form, activating it submitted the form. That is the stalled "Load earlier messages" control in ConversationEarlier and the Retry control in SendStatusLine. Button now renders type="button" unless a type is passed. asChild gets no injected type, since the slotted child may not be a button. BREAKING CHANGE: a bare Button no longer submits a form. Pass type="submit" for a submit button. Addresses corbitsdev#142 findings 8 and 9.
pratikbuilds
force-pushed
the
claude/i142-button-type-4ccef8
branch
from
November 3, 2026 06:44
588d960 to
a34c3bb
Compare
Drop the comment that restated the destructured type default. Throw when a test query is not the expected element instead of casting away null.
Slot spreads slot props over the child, so type={undefined} clears a
child type="button" and the click submits. Pass type only when it is
a string.
TheGreatAxios
approved these changes
Nov 4, 2026
TheGreatAxios
left a comment
Contributor
There was a problem hiding this comment.
Approving. A native button with an omitted or undefined type renders type="button" and does not submit. asChild omits type unless the caller passed a real string, so a child that sets type="button" before spreading props keeps it.
TheGreatAxios
dismissed stale reviews from corbits-triage[bot], corbits-triage[bot], and corbits-triage[bot]
November 4, 2026 07:29
The type default is fixed and policy-check is green. Dismissing the stale triage change request.
Contributor
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Buttonrenders a native<button>, and a<button>with notypeis a submit button. Inside a host form, every bareButtonsubmitted the form.Buttonnow defaultstypeto"button"whenasChildis false. An omitted orundefinedtypestill renderstype="button". An explicittypestill wins.asChildgets no injected type, since the slotted child may not be a button.Breaking: a bare
Buttonno longer submits a form. Passtype="submit"for a submit button.Closes #142