Skip to content

Commit

Permalink
Remove re-application of unstyled button styles
Browse files Browse the repository at this point in the history
**Why**: It should not be necessary, because USWDS handles hover and active unstyled states, but does not currently do so for the modifier classes. Previously, we worked around this by including the unstyled button mixin, which would have a higher specificity than the default button's hover styles. Unfortunately, this also comes with some unexpected consequences, such as the re-application of the USWDS focus ring, which we expect to override in our own default button styles.
  • Loading branch information
aduth committed Mar 10, 2021
1 parent 8a6b483 commit afecbdd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/scss/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@
position: relative;
text-underline-offset: 3px;

// In USWDS, unstyled button styles are applied last to take precedence over base button styles.
// Since we override base button styles, we must re-apply the unstyled button styles.
&.usa-button {
@include button-unstyled;
// USWDS currently only sets hover and active unstyled button styles for the browser-native
// states, and not with the modifier classes. It also does not apply these styles to the disabled
// button, allowing some background color to bleed through. These overrides may be removed if an
// upstream fix is merged.
//
// See: https://github.com/uswds/uswds/pull/4077
&.usa-button--hover,
&.usa-button--active,
&:disabled,
&.usa-button--disabled {
@include no-knockout-font-smoothing;
background-color: transparent;
box-shadow: none;
text-decoration: underline;
}

// Hover colors are already applied by USWDS via `typeset-link`, but this does not include the
Expand Down

0 comments on commit afecbdd

Please sign in to comment.