Skip to content

Commit a28e478

Browse files
MartijnCuppensXhmikosR
authored andcommitted
Backport #30391
transition() mixin prevent redundant 'transition: none' and pass `null`
1 parent 8cc9def commit a28e478

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scss/mixins/_transition.scss

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
// stylelint-disable property-blacklist
22
@mixin transition($transition...) {
3+
@if length($transition) == 0 {
4+
$transition: $transition-base;
5+
}
6+
7+
@if length($transition) > 1 {
8+
@each $value in $transition {
9+
@if $value == null or $value == none {
10+
@warn "The keyword 'none' or 'null' must be used as a single argument.";
11+
}
12+
}
13+
}
14+
315
@if $enable-transitions {
4-
@if length($transition) == 0 {
5-
transition: $transition-base;
6-
} @else {
16+
@if nth($transition, 1) != null {
717
transition: $transition;
818
}
919

10-
@if $enable-prefers-reduced-motion-media-query {
20+
@if $enable-prefers-reduced-motion-media-query and nth($transition, 1) != null and nth($transition, 1) != none {
1121
@media (prefers-reduced-motion: reduce) {
1222
transition: none;
1323
}

0 commit comments

Comments
 (0)