3.1.x: Add type= to any theme buttons

Created on 10 February 2023, about 2 years ago
Updated 22 March 2023, about 2 years ago

Problem/Motivation

⚠️ Added type="button" to all non-form buttons to prevent default submit behaviors. This allowed us to remove preventDefault() from the relevant component JS.

This is a potentially breaking change. Teams should update all non-form buttons to include type="button" in their markup. elements that do not receive a defined type attribute will inherit type="submit" behaviors by default. This can cause unintended and undesired behavior in our buttons. Resource: Details on button types (Mozilla) (#4695)

This also affects these dependent or related packages:

usa-accordion
usa-banner
usa-card
usa-header
usa-navbar
usa-modal
usa-nav
usa-sidenav

Proposed resolution

Modify twig files and code (if needed) to add type=button or type=submit if necessary.

πŸ“Œ Task
Status

Fixed

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mferanda

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024