Skip to content

[Task] ToggleSwitch internal button defaults to submit inside forms #3939

@acbreton

Description

@acbreton

Summary

Primer::Alpha::ToggleSwitch renders a <button> without type. Inside a <form>, it defaults to type="submit" and can trigger Chrome “required field” validation tooltips on other empty inputs.

Repro

  1. Put ToggleSwitch inside a form with an empty required field.
  2. Click the toggle.
  3. Chrome shows native validation tooltips / acts like a submit.

Fix

Render the track button with type="button" and add a test for .ToggleSwitch-track[type="button"].

References

Screen.Recording.2026-02-12.at.12.27.06.PM.mov

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions