From b4e4bed9e363721b06901b1e58cbf1ae70c881eb Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 28 Apr 2021 15:41:15 -0400 Subject: [PATCH] Consolidate unstyled font smoothing styles (#206) **Why**: - Account for missing `usa-button--unstyled:hover` and `usa-button--unstyled:active` - Single point to remove in the future, as noted in the preceding comment --- CHANGELOG.md | 1 + src/scss/components/_buttons.scss | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d24e321b..d37c1629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix rounded corners on sidebar current page item. - Fix unintentional rounded corners on search text field. - Fix utility classes not always applying as expected when applied to components. For example, using `margin-` utility classes on an unstyled button would previously unexpectedly conflict with and not take precedent over the button's own margins. +- Fix all instances of font weight appearance of unstyled buttons in content which applies anti-aliased font smoothing. Previous bug fix attempts had still missed default `:hover` and `:active` states. ## 5.0.3 diff --git a/src/scss/components/_buttons.scss b/src/scss/components/_buttons.scss index 88256784..175c72af 100644 --- a/src/scss/components/_buttons.scss +++ b/src/scss/components/_buttons.scss @@ -26,8 +26,16 @@ $button-stroke-big: inset 0 0 0 units($theme-button-stroke-width * 2); // reset, these styles could be safely removed. // // See: https://github.com/uswds/uswds/pull/4115 - -moz-osx-font-smoothing: inherit; - -webkit-font-smoothing: inherit; + &, + &:hover, + &.usa-button--hover, + &:active, + &.usa-button--active, + &:disabled, + &.usa-button--disabled { + -moz-osx-font-smoothing: inherit; + -webkit-font-smoothing: inherit; + } // 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 @@ -39,8 +47,6 @@ $button-stroke-big: inset 0 0 0 units($theme-button-stroke-width * 2); &.usa-button--active, &:disabled, &.usa-button--disabled { - -moz-osx-font-smoothing: inherit; - -webkit-font-smoothing: inherit; background-color: transparent; box-shadow: none; text-decoration: underline;