Skip to content

Commit

Permalink
Match the primary button disabled state to Core's color contrast (#16103
Browse files Browse the repository at this point in the history
)

* See #15280. This fixes the primary button's disabled view to match core primary disabled buttons.

* Removed unecessary opacity attribute in css.

* Revising tint and shade Sass values to get closer to Core.

* Minor CSS edit to remove text shadow from disabled buttons.

* Added active state to disabled state to remove active change of color.

* Fixed the focus state of disabled primary button to keep the disabled text color.

* A few minor CSS tweaks to fix the border inset shadow.

* Move disabled focus styles alongside other disabled rules.

* Ensure disabled state persists for alternate color schemes.
  • Loading branch information
mapk authored Jul 11, 2019
1 parent 9aab86d commit 1e9225a
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,30 @@
}

&:disabled,
&[aria-disabled="true"] {
color: color(theme(button) tint(30%));
background: color(theme(button) shade(30%));
border-color: color(theme(button) shade(20%));
&:disabled:active:enabled,
&[aria-disabled="true"],
&[aria-disabled="true"]:active:enabled {
color: color(theme(button) tint(40%));
background: color(theme(button));
border-color: color(theme(button) shade(7%));
box-shadow: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1);
text-shadow: none;

// This specificity is needed to override alternate color schemes in WP-Admin.
&.is-button,
&.is-button:hover,
&:active:enabled {
box-shadow: none;
text-shadow: none;
}

&:focus:enabled {
color: color(theme(button) tint(40%));
border-color: color(theme(button) shade(7%));
box-shadow:
0 0 0 1px $white,
0 0 0 3px $blue-medium-focus;
}
}

&.is-busy,
Expand Down Expand Up @@ -171,7 +189,6 @@
&:disabled,
&[aria-disabled="true"] {
cursor: default;
opacity: 0.3;
}

&:focus:not(:disabled) {
Expand Down

0 comments on commit 1e9225a

Please sign in to comment.