Skip to content

Commit

Permalink
Drop all hover mixins
Browse files Browse the repository at this point in the history
Previously deprecated in v4.x, this clears out the now unused Sass option and removes some unused mixins. Arguably we could remove more, but I like the hover-focus mixin and we make extensive use of it across the project.
  • Loading branch information
mdo authored and XhmikosR committed May 8, 2019
1 parent a827934 commit 1d4d9f8
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 84 deletions.
4 changes: 1 addition & 3 deletions scss/_button-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

// Bring the hover, focused, and "active" buttons to the front to overlay
// the borders properly
@include hover {
z-index: 1;
}
&:hover,
&:focus,
&:active,
&.active {
Expand Down
4 changes: 2 additions & 2 deletions scss/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
@include transition($btn-transition);

@include hover {
&:hover {
color: $body-color;
text-decoration: none;
}
Expand Down Expand Up @@ -79,7 +79,7 @@ fieldset:disabled a.btn {
color: $btn-link-color;
text-decoration: $link-decoration;

@include hover {
&:hover {
color: $btn-link-hover-color;
text-decoration: $link-hover-decoration;
}
Expand Down
2 changes: 1 addition & 1 deletion scss/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}

.card-link {
@include hover {
&:hover {
text-decoration: none;
}

Expand Down
3 changes: 2 additions & 1 deletion scss/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
@include transition($carousel-control-transition);

// Hover/focus state
@include hover-focus {
&:hover,
&:focus {
color: $carousel-control-color;
text-decoration: none;
outline: 0;
Expand Down
5 changes: 3 additions & 2 deletions scss/_close.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
opacity: .5;

// Override <a>'s hover style
@include hover {
&:hover {
color: $close-color;
text-decoration: none;
}

&:not(:disabled):not(.disabled) {
@include hover-focus {
&:hover,
&:focus {
opacity: .75;
}
}
Expand Down
3 changes: 2 additions & 1 deletion scss/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
}
}

@include hover-focus {
&:hover,
&:focus {
color: $dropdown-link-hover-color;
text-decoration: none;
@include gradient-bg($dropdown-link-hover-bg);
Expand Down
3 changes: 2 additions & 1 deletion scss/_list-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
text-align: inherit; // For `<button>`s (anchors inherit)

// Hover state
@include hover-focus {
&:hover,
&:focus {
z-index: 1; // Place hover/focus items above their siblings for proper border styling
color: $list-group-action-hover-color;
text-decoration: none;
Expand Down
1 change: 0 additions & 1 deletion scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// Utilities
@import "mixins/breakpoints";
@import "mixins/hover";
@import "mixins/image";
@import "mixins/resize";
@import "mixins/screen-reader";
Expand Down
6 changes: 4 additions & 2 deletions scss/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
display: block;
padding: $nav-link-padding-y $nav-link-padding-x;

@include hover-focus {
&:hover,
&:focus {
text-decoration: none;
}

Expand All @@ -42,7 +43,8 @@
border: $nav-tabs-border-width solid transparent;
@include border-top-radius($nav-tabs-border-radius);

@include hover-focus {
&:hover,
&:focus {
border-color: $nav-tabs-link-hover-border-color;
}

Expand Down
35 changes: 19 additions & 16 deletions scss/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
line-height: inherit;
white-space: nowrap;

@include hover-focus {
&:hover,
&:focus {
text-decoration: none;
}
}
Expand Down Expand Up @@ -112,7 +113,8 @@
border: $border-width solid transparent; // remove default button style
@include border-radius($navbar-toggler-border-radius);

@include hover-focus {
&:hover,
&:focus {
text-decoration: none;
}
}
Expand Down Expand Up @@ -193,7 +195,8 @@
.navbar-brand {
color: $navbar-light-brand-color;

@include hover-focus {
&:hover,
&:focus {
color: $navbar-light-brand-hover-color;
}
}
Expand All @@ -202,7 +205,8 @@
.nav-link {
color: $navbar-light-color;

@include hover-focus {
&:hover,
&:focus {
color: $navbar-light-hover-color;
}

Expand Down Expand Up @@ -230,12 +234,11 @@

.navbar-text {
color: $navbar-light-color;
a {
color: $navbar-light-active-color;

@include hover-focus {
color: $navbar-light-active-color;
}
a,
a:hover,
a:focus {
color: $navbar-light-active-color;
}
}
}
Expand All @@ -245,7 +248,8 @@
.navbar-brand {
color: $navbar-dark-brand-color;

@include hover-focus {
&:hover,
&:focus {
color: $navbar-dark-brand-hover-color;
}
}
Expand All @@ -254,7 +258,8 @@
.nav-link {
color: $navbar-dark-color;

@include hover-focus {
&:hover,
&:focus {
color: $navbar-dark-hover-color;
}

Expand Down Expand Up @@ -282,12 +287,10 @@

.navbar-text {
color: $navbar-dark-color;
a {
a,
a:hover,
a:focus {
color: $navbar-dark-active-color;

@include hover-focus {
color: $navbar-dark-active-color;
}
}
}
}
12 changes: 4 additions & 8 deletions scss/_reboot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ a {
text-decoration: $link-decoration;
background-color: transparent; // Remove the gray background on active links in IE 10.

@include hover {
&:hover {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
Expand All @@ -232,15 +232,11 @@ a {
// See https://github.com/twbs/bootstrap/issues/19402

a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;

@include hover-focus {
&,
&:hover,
&:focus {
color: inherit;
text-decoration: none;
}

&:focus {
outline: 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions scss/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

.table-hover {
tbody tr {
@include hover {
&:hover {
color: $table-hover-color;
background-color: $table-hover-bg;
}
Expand Down Expand Up @@ -149,7 +149,7 @@

&.table-hover {
tbody tr {
@include hover {
&:hover {
color: $table-dark-hover-color;
background-color: $table-dark-hover-bg;
}
Expand Down
1 change: 0 additions & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ $enable-shadows: false !default;
$enable-gradients: false !default;
$enable-transitions: true !default;
$enable-prefers-reduced-motion-media-query: true !default;
$enable-hover-media-query: false !default; // Deprecated, no longer affects any compiled CSS
$enable-grid-classes: true !default;
$enable-pointer-cursor-for-buttons: true !default;
$enable-print-styles: true !default;
Expand Down
4 changes: 2 additions & 2 deletions scss/mixins/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
border-color: $border;
@include box-shadow($btn-box-shadow);

@include hover {
&:hover {
color: color-yiq($hover-background);
@include gradient-bg($hover-background);
border-color: $hover-border;
Expand Down Expand Up @@ -65,7 +65,7 @@
color: $color;
border-color: $color;

@include hover {
&:hover {
color: $color-hover;
background-color: $active-background;
border-color: $active-border;
Expand Down
37 changes: 0 additions & 37 deletions scss/mixins/_hover.scss

This file was deleted.

3 changes: 2 additions & 1 deletion scss/mixins/_list-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
background-color: $background;

&.list-group-item-action {
@include hover-focus {
&:hover,
&:focus {
color: $color;
background-color: darken($background, 5%);
}
Expand Down
2 changes: 1 addition & 1 deletion scss/mixins/_table-row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$hover-background: darken($background, 5%);

.table-#{$state} {
@include hover {
&:hover {
background-color: $hover-background;

> td,
Expand Down
3 changes: 2 additions & 1 deletion scss/mixins/_text-emphasis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
}
@if $emphasized-link-hover-darken-percentage != 0 {
a#{$parent} {
@include hover-focus {
&:hover,
&:focus {
color: darken($color, $emphasized-link-hover-darken-percentage) !important;
}
}
Expand Down
1 change: 1 addition & 0 deletions site/content/docs/4.3/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ See the browser and devices page for details on what is currently supported in B

Changes to our source Sass files and compiled CSS.

- Removed `hover`, `hover-focus`, `plain-hover-focus`, and `hover-focus-active` mixins. Use regular CSS syntax for these moving forward. [See #28267](https://github.com/twbs/bootstrap/pull/28267).
- **Todo:** Remove previously deprecated mixins
- `float()`
- `form-control-mixin()`
Expand Down
2 changes: 1 addition & 1 deletion site/static/docs/4.3/assets/scss/_skippy.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
background-color: $bd-purple;
outline: 0;

@include hover {
&:hover {
color: $white;
}
}
Expand Down

0 comments on commit 1d4d9f8

Please sign in to comment.