aboutsummaryrefslogtreecommitdiff
path: root/scss
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-12-26 14:42:29 -0800
committerMark Otto <[email protected]>2016-12-28 15:12:04 -0800
commit7aa2a52069dbda20e395b5c84b7522b255eeffd3 (patch)
tree4e391d68a7452f95ec589ec9c262c137c1c64bce /scss
parent150625265b6f23e228cd7fc67b83af19044d525f (diff)
downloadbootstrap-7aa2a52069dbda20e395b5c84b7522b255eeffd3.tar.xz
bootstrap-7aa2a52069dbda20e395b5c84b7522b255eeffd3.zip
Redo button states
Trying to simplify our output here by revamping these selectors. We overcomplicated things by setting hover styles for nearly every state (disabled and active included), and we set them in the wrong order. This commit does the following: - Reorders states so disabled comes before active, thereby removing the need to set disabled-active styles. - Removes all focus and hover styles from disabled states as those will naturally inherit from the default button state. - Renamed `.open` to `.show` to fix dropdown toggle highlighting. - Tweaked some indendation in the Sass.
Diffstat (limited to 'scss')
-rw-r--r--scss/_buttons.scss26
-rw-r--r--scss/mixins/_buttons.scss74
2 files changed, 35 insertions, 65 deletions
diff --git a/scss/_buttons.scss b/scss/_buttons.scss
index 8ea2bb764..6b924a5c6 100644
--- a/scss/_buttons.scss
+++ b/scss/_buttons.scss
@@ -17,15 +17,12 @@
@include button-size($btn-padding-y, $btn-padding-x, $font-size-base, $btn-border-radius);
@include transition($btn-transition);
- &,
- &:active,
- &.active {
- &:focus,
- &.focus {
- @include tab-focus();
- }
+ &:focus,
+ &.focus {
+ @include tab-focus();
}
+ // Share hover and focus styles
@include hover-focus {
text-decoration: none;
}
@@ -33,19 +30,20 @@
text-decoration: none;
}
- &:active,
- &.active {
- background-image: none;
- outline: 0;
- @include box-shadow($btn-active-box-shadow);
- }
-
+ // Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
cursor: $cursor-disabled;
opacity: .65;
@include box-shadow(none);
}
+
+ &:active,
+ &.active {
+ background-image: none;
+ outline: 0;
+ @include box-shadow($btn-active-box-shadow);
+ }
}
// Future-proof disabling of clicks on `<a>` elements
diff --git a/scss/mixins/_buttons.scss b/scss/mixins/_buttons.scss
index 853a46bfc..7a0a08a65 100644
--- a/scss/mixins/_buttons.scss
+++ b/scss/mixins/_buttons.scss
@@ -12,49 +12,34 @@
border-color: $border;
@include box-shadow($btn-box-shadow);
+ // Hover and focus styles are shared
@include hover {
color: $color;
background-color: $active-background;
- border-color: $active-border;
+ border-color: $active-border;
}
-
&:focus,
&.focus {
color: $color;
background-color: $active-background;
- border-color: $active-border;
+ border-color: $active-border;
+ }
+
+ // Disabled comes first so active can properly restyle
+ &.disabled,
+ &:disabled {
+ background-color: $background;
+ border-color: $border;
}
&:active,
&.active,
- .open > &.dropdown-toggle {
+ .show > &.dropdown-toggle {
color: $color;
background-color: $active-background;
- border-color: $active-border;
- // Remove the gradient for the pressed/active state
- background-image: none;
+ border-color: $active-border;
+ background-image: none; // Remove the gradient for the pressed/active state
@include box-shadow($btn-active-box-shadow);
-
- &:hover,
- &:focus,
- &.focus {
- color: $color;
- background-color: darken($background, 17%);
- border-color: darken($border, 25%);
- }
- }
-
- &.disabled,
- &:disabled {
- &:focus,
- &.focus {
- background-color: $background;
- border-color: $border;
- }
- @include hover {
- background-color: $background;
- border-color: $border;
- }
}
}
@@ -67,41 +52,28 @@
@include hover {
color: $color-hover;
background-color: $color;
- border-color: $color;
+ border-color: $color;
}
&:focus,
&.focus {
color: $color-hover;
background-color: $color;
- border-color: $color;
+ border-color: $color;
+ }
+
+ &.disabled,
+ &:disabled {
+ color: $color;
+ background-color: transparent;
}
&:active,
&.active,
- .open > &.dropdown-toggle {
+ .show > &.dropdown-toggle {
color: $color-hover;
background-color: $color;
- border-color: $color;
-
- &:hover,
- &:focus,
- &.focus {
- color: $color-hover;
- background-color: darken($color, 17%);
- border-color: darken($color, 25%);
- }
- }
-
- &.disabled,
- &:disabled {
- &:focus,
- &.focus {
- border-color: lighten($color, 20%);
- }
- @include hover {
- border-color: lighten($color, 20%);
- }
+ border-color: $color;
}
}