Skip to content

added default button type to switch button to prevent submit when included in form #5841

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

Merged
merged 13 commits into from
Apr 22, 2025

Conversation

dwsosa
Copy link
Contributor

@dwsosa dwsosa commented Mar 29, 2025

Closes #5823

Added a variable to the switch button interface and added a default value of "button" so that the toggleswitch component doesnt default to "submit" which is an issue when the toggleswitch is added to a form

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Jest test result to confirm the type attribute has value "button"
testsuite

@dwsosa dwsosa requested a review from a team as a code owner March 29, 2025 04:42
@dwsosa dwsosa requested a review from jonrohan March 29, 2025 04:42
Copy link

changeset-bot bot commented Mar 29, 2025

🦋 Changeset detected

Latest commit: 54b392d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dwsosa
Copy link
Contributor Author

dwsosa commented Mar 29, 2025

This PR implements the change for the ToggleSwitch default behavior to act as a button rather than a submit button. I haven't added the full test suite yet, and I'm looking for guidance on what tests would be most valuable for this change. I'm eager to iterate based on your feedback.

@jonrohan jonrohan added this pull request to the merge queue Apr 22, 2025
Merged via the queue into primer:main with commit fe429d7 Apr 22, 2025
41 of 42 checks passed
@primer primer bot mentioned this pull request Apr 22, 2025
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.

ToggleSwitch button type="submit"
2 participants