Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type="button" by default to Button component #288

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

kevin940726
Copy link
Collaborator

<Button> component should have type="button" by default, or else it will default to type="submit" when placing inside a <form> element. It's also the default value in gutenberg's <Button> component: https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/button/index.js#L77

Alternatively, we can enforce explicit type attribute with tools like eslint.

I ran into this problem when trying to place some components here inside a <form> element: WordPress/gutenberg#29755 (comment). IMHO, this should be handled in the design system rather in the app level.

@vercel
Copy link

vercel bot commented Mar 15, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/itsjonq/g2/8rDG3RboGxFcCHMtrBbsPawR4cYX
✅ Preview: https://g2-git-fork-kevin940726-update-add-type-to-button-itsjonq.vercel.app

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

Successfully merging this pull request may close these issues.

2 participants