Skip to content

buttons now have type button by default#2103

Open
lordofthecactus wants to merge 1 commit into
v1.x-2022-07from
feat/default-button-type
Open

buttons now have type button by default#2103
lordofthecactus wants to merge 1 commit into
v1.x-2022-07from
feat/default-button-type

Conversation

@lordofthecactus

Copy link
Copy Markdown
Contributor

Description

Our buttons use the default browser type which is html. This change makes type button the default.

In react we usually have click handlers instead of relying in default html form submissions which force the page to re-render.

Reasons we should do this:

  1. Having this default button type improves dx
  2. No writing type=button on all buttons
  3. Most UI libraries (e.g. Chakra UI, MUI) use this as their default as well.

Reason not to do this:

  1. Defaults of browser are good enough and we should stick to them to improve our non-javascript code. e.g. form submissions without click handlers

Thoughts?

@github-actions

github-actions Bot commented Sep 8, 2022

Copy link
Copy Markdown
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run "yarn changeset add" to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

@frehner frehner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Technically a breaking change, though a small one.
  • Needs a changeset added, with a migration guide
  • Documentation for each button should be updated to reflect that this is now the default

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.

2 participants