Skip to content

Commit

Permalink
Improve Button aria-disabled focus style.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Jun 24, 2024
1 parent e748ece commit 0e2e251
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@
}

&[aria-expanded="true"],
&:hover {
&:hover:not(:disabled, [aria-disabled="true"]) {
color: $components-color-accent;
}

// Unset some hovers, instead of adding :not specificity.
&:disabled:hover,
&[aria-disabled="true"]:hover {
color: initial;
}

// Focus.
// See https://github.com/WordPress/gutenberg/issues/13267 for more context on these selectors.
&:focus:not(:disabled) {
Expand Down Expand Up @@ -80,7 +74,6 @@
color: rgba($white, 0.4);
background: $components-color-accent;
border-color: $components-color-accent;
opacity: 1;
outline: none;

&:focus:enabled {
Expand Down Expand Up @@ -125,7 +118,6 @@
color: $gray-600;
background: transparent;
transform: none;
opacity: 1;
}
}

Expand Down Expand Up @@ -199,17 +191,22 @@
&:not(.is-primary):not(.is-secondary):not(.is-tertiary):not(.is-link) {
color: $alert-red;

&:hover:not(:disabled) {
&:hover:not(:disabled, [aria-disabled="true"]) {
color: darken($alert-red, 20%);
}

&:focus:not(:disabled) {
&:focus {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $alert-red;
}

&:active:not(:disabled) {
&:active:not(:disabled, [aria-disabled="true"]) {
background: $gray-400;
}

&:disabled,
&[aria-disabled="true"] {
color: lighten($alert-red, 40%);
}
}
}

Expand Down Expand Up @@ -237,6 +234,11 @@
&:focus {
border-radius: $radius-block-ui;
}

&:disabled,
&[aria-disabled="true"] {
color: $gray-600;
}
}

&:not(:disabled, [aria-disabled="true"]):active {
Expand All @@ -246,7 +248,11 @@
&:disabled,
&[aria-disabled="true"] {
cursor: default;
opacity: 0.3;
color: $gray-600;

svg {
opacity: 0.66;
}
}

&.is-busy,
Expand All @@ -259,7 +265,6 @@
@media (prefers-reduced-motion: reduce) {
animation-duration: 0s;
}
opacity: 1;
background-size: 100px 100%;
/* stylelint-disable -- Disable reason: This function call looks nicer when each argument is on its own line. */
background-image: linear-gradient(
Expand Down

0 comments on commit 0e2e251

Please sign in to comment.