Skip to content

Commit

Permalink
Fix active, disabled, unstyled button background color (#4881) (#5025)
Browse files Browse the repository at this point in the history
* Fix active, disabled, unstyled button background color

**Why**: When an unstyled button is used as the submit button in a form, it can cause an issue where clicking the button would make it both disabled and active. This is because our default form validation will disable all submit buttons when a form is submitted. Since this happens at the same time as the link activation, and since the USWDS default disabled button styles conflict with the unstyled link appearance, an undesirable background color can be shown.

* Match full selector chain from disabled styles
  • Loading branch information
aduth committed May 4, 2021
1 parent 6d8701e commit b2d6747
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/assets/stylesheets/components/_btn.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
// of a link.
display: inline;
width: auto;

// Temporary: To be backported to design system. Unstyled buttons should not ever show the default
// opaque disabled background color. Typically a button would not be both disabled and active, but
// it is possible in some browsers when e.g. disabling a button in response to its own click.
&.usa-button:disabled:hover,
&.usa-button:disabled.usa-button--hover,
&.usa-button:disabled:active,
&.usa-button:disabled.usa-button--active,
&.usa-button:disabled:focus,
&.usa-button:disabled.usa-focus {
background-color: transparent;
}
}

.usa-button--disabled {
Expand Down

0 comments on commit b2d6747

Please sign in to comment.