Skip to content

fix(button): keep native submit button in the dom for implicit form submission#640

Open
samrichardsontylertech wants to merge 15 commits intomainfrom
fix/submit-button
Open

fix(button): keep native submit button in the dom for implicit form submission#640
samrichardsontylertech wants to merge 15 commits intomainfrom
fix/submit-button

Conversation

@samrichardsontylertech
Copy link
Contributor

@samrichardsontylertech samrichardsontylertech commented Jun 27, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added/updated: Y
  • Docs have been added/updated: N
  • Does this PR introduce a breaking change? N
  • I have linked any related GitHub issues to be closed when this PR is merged? N

Describe the new behavior?

This adds a persistent slotted, hidden <button type="submit"></button> to the base button component to enable implicit form submission, e.g. when a user presses the enter key while a form input is focused.

@samrichardsontylertech samrichardsontylertech added patch Increment the patch version when merged skip-release Preserve the current version when merged labels Jun 27, 2024
@samrichardsontylertech samrichardsontylertech requested a review from a team as a code owner June 27, 2024 19:54
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@samrichardsontylertech samrichardsontylertech changed the title fix(button): keep native submit or reset button in the dom for implicit form submission fix(button): keep native submit button in the dom for implicit form submission Apr 4, 2025
DRiFTy17
DRiFTy17 previously approved these changes Apr 4, 2025
Copy link
Collaborator

@DRiFTy17 DRiFTy17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. While it does feel like a hacky workaround, the goal is to provide a seamless integration for devs to enable pressing the enter key while on a focused input within a <form>.

I just want to remind anyone that looks at this PR that the intention behind this change is to provide a stop-gap solution for handling form submission until the browser APIs allow for us to configure our buttons as "submit" buttons. When that is available, we will switch over and remove this temporary solution.

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

Labels

patch Increment the patch version when merged skip-release Preserve the current version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants