Skip to content

feat: respect animation @.disabled binding #12829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/button/_button-base.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import '../core/style/variables';
@import '../core/style/elevation';
@import '../core/style/button-common';
@import '../core/style/noop-animation';


// Flat and raised button standards
Expand Down Expand Up @@ -76,14 +75,17 @@ $mat-mini-fab-padding: 8px !default;
// Applies styles to buttons with backgrounds: raised, fab, and mini-fab
@mixin mat-raised-button {
@include mat-button-base;
@include _noop-animation();

// Force hardware acceleration.
transform: translate3d(0, 0, 0);

// Animation.
transition: background $swift-ease-out-duration $swift-ease-out-timing-function,
mat-elevation-transition-property-value();

&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
transition: none;
}
}

// Applies styles to fab and mini-fab button types only
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

transition: $mat-button-focus-transition;

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}

Expand Down
11 changes: 6 additions & 5 deletions src/lib/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@import '../core/style/checkbox-common';
@import '../core/ripple/ripple';
@import '../core/style/layout-common';
@import '../core/style/noop-animation';
@import '../../cdk/a11y/a11y';

// Manual calculation done on SVG
Expand Down Expand Up @@ -174,12 +173,14 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
}

.mat-checkbox {
@include _noop-animation();

// Animation
transition: background $swift-ease-out-duration $swift-ease-out-timing-function,
mat-elevation-transition-property-value();

&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
transition: none;
}

cursor: pointer;
-webkit-tap-highlight-color: transparent;

Expand Down Expand Up @@ -237,7 +238,7 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
style: solid;
}

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}

Expand All @@ -260,7 +261,7 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
$mat-linear-out-slow-in-timing-function,
opacity $mat-checkbox-transition-duration $mat-linear-out-slow-in-timing-function;

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import '../../style/checkbox-common';
@import '../../style/noop-animation';

// Padding inside of a pseudo checkbox.
$_mat-pseudo-checkbox-padding: $mat-checkbox-border-width * 2;
Expand Down Expand Up @@ -36,7 +35,9 @@ $_mat-pseudo-checkmark-size: $mat-checkbox-size - (2 * $_mat-pseudo-checkbox-pad
border-color: transparent;
}

@include _noop-animation {
&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
transition: none;

&::after {
transition: none;
}
Expand Down
22 changes: 0 additions & 22 deletions src/lib/core/style/_noop-animation.scss

This file was deleted.

8 changes: 5 additions & 3 deletions src/lib/form-field/form-field-fill.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ $mat-form-field-fill-subscript-padding:
}
}

&._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover {
& ~ .mat-form-field-underline .mat-form-field-ripple {
transition: none;
&:not(.mat-form-field-disabled) {
&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
.mat-form-field-flex:hover ~ .mat-form-field-underline .mat-form-field-ripple {
transition: none;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/form-field/form-field-outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ $mat-form-field-outline-subscript-padding:
padding: 0 $mat-form-field-outline-subscript-padding;
}

&._mat-animation-noopable {
&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
&:not(.mat-form-field-disabled) .mat-form-field-flex:hover ~ .mat-form-field-outline,
.mat-form-field-outline,
.mat-form-field-outline-start,
Expand Down
8 changes: 5 additions & 3 deletions src/lib/form-field/form-field-standard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ $mat-form-field-standard-padding-top: 0.75em !default;
}
}

&._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover {
& ~ .mat-form-field-underline .mat-form-field-ripple {
transition: none;
&:not(.mat-form-field-disabled) {
&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
.mat-form-field-flex:hover ~ .mat-form-field-underline .mat-form-field-ripple {
transition: none;
}
}
}
}
2 changes: 1 addition & 1 deletion src/lib/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ $mat-form-field-default-infix-width: 180px !default;
position: relative;
}

.mat-form-field._mat-animation-noopable {
._mat-animation-noopable, .ng-animate-disabled {
.mat-form-field-label,
.mat-form-field-ripple {
transition: none;
Expand Down
8 changes: 5 additions & 3 deletions src/lib/progress-bar/progress-bar.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import '../core/style/variables';
@import '../core/style/vendor-prefixes';
@import '../core/style/noop-animation';
@import '../../cdk/a11y/a11y';

$mat-progress-bar-height: 4px !default;
Expand All @@ -9,7 +8,6 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;


.mat-progress-bar {
@include _noop-animation();
display: block;
// Height is provided for mat-progress-bar to act as a default.
height: $mat-progress-bar-height;
Expand All @@ -18,6 +16,10 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
transition: opacity $mat-progress-bar-piece-animation-duration linear;
width: 100%;

&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
transition: none;
}

// Base styles that are re-used across all of the progress bar children.
.mat-progress-bar-element, .mat-progress-bar-fill::after {
height: 100%;
Expand Down Expand Up @@ -137,7 +139,7 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
}

// Disabled animations handling.
&._mat-animation-noopable {
&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
.mat-progress-bar-fill,
.mat-progress-bar-fill::after,
.mat-progress-bar-buffer,
Expand Down
16 changes: 9 additions & 7 deletions src/lib/progress-spinner/progress-spinner.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@import '../core/style/variables';
@import '../core/style/noop-animation';


// Animation config
$mat-progress-spinner-stroke-rotate-fallback-duration: 10 * 1000ms !default;
Expand All @@ -13,6 +11,15 @@ $_mat-progress-spinner-default-circumference: $pi * $_mat-progress-spinner-defau
display: block;
position: relative;

&._mat-animation-noopable, &.ng-animate-disabled, .ng-animate-disabled & {
animation: none;

circle {
animation: none;
transition: none;
}
}

svg {
position: absolute;
transform: rotate(-90deg);
Expand All @@ -23,19 +30,16 @@ $_mat-progress-spinner-default-circumference: $pi * $_mat-progress-spinner-defau
}

circle {
@include _noop-animation();
fill: transparent;
transform-origin: center;
transition: stroke-dashoffset 225ms linear;
}

&.mat-progress-spinner-indeterminate-animation[mode='indeterminate'] {
@include _noop-animation();
animation: mat-progress-spinner-linear-rotate $swift-ease-in-out-duration * 4
linear infinite;

circle {
@include _noop-animation();
transition-property: stroke;
// Note: we multiply the duration by 8, because the animation is spread out in 8 stages.
animation-duration: $swift-ease-in-out-duration * 8;
Expand All @@ -45,14 +49,12 @@ $_mat-progress-spinner-default-circumference: $pi * $_mat-progress-spinner-defau
}

&.mat-progress-spinner-indeterminate-fallback-animation[mode='indeterminate'] {
@include _noop-animation();
animation: mat-progress-spinner-stroke-rotate-fallback
$mat-progress-spinner-stroke-rotate-fallback-duration
$mat-progress-spinner-stroke-rotate-fallback-ease
infinite;

circle {
@include _noop-animation();
transition-property: stroke;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/radio/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $mat-radio-ripple-radius: 20px;
radius: 50%;
}

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}
}
Expand All @@ -69,7 +69,7 @@ $mat-radio-ripple-radius: 20px;
// IE to flash the entire circle for a couple of frames, throwing off the entire animation.
transform: scale(0.001);

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}

Expand Down
10 changes: 7 additions & 3 deletions src/lib/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
transition: transform $swift-ease-out-duration $swift-ease-out-timing-function;
}

._mat-animation-noopable.mat-form-field-appearance-standard .mat-select.mat-select-empty & {
transition: none;
.mat-form-field-appearance-standard {
.ng-animate-disabled &, &.ng-animate-disabled, &._mat-animation-noopable {
.mat-select.mat-select-empty {
transition: none;
}
}
}
}

Expand Down Expand Up @@ -121,7 +125,7 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
transition: color $swift-ease-out-duration $swift-ease-out-duration / 3
$swift-ease-out-timing-function;

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
transition-duration: 0ms;
}

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}

Expand Down Expand Up @@ -173,7 +173,7 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg
transition-property: background-color;
transition-delay: 50ms;

._mat-animation-noopable & {
._mat-animation-noopable &, .ng-animate-disabled & {
transition: none;
}
}
Expand Down
25 changes: 13 additions & 12 deletions src/lib/slider/slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,18 @@ $mat-slider-focus-ring-size: 30px !default;
}
}

// Slider inside a component with disabled animations.
.mat-slider._mat-animation-noopable {
.mat-slider-track-fill,
.mat-slider-track-background,
.mat-slider-ticks,
.mat-slider-thumb-container,
.mat-slider-focus-ring,
.mat-slider-thumb,
.mat-slider-thumb-label,
.mat-slider-thumb-label-text,
.mat-slider-has-ticks .mat-slider-wrapper::after {
transition: none;
.mat-slider {
.ng-animate-disabled &, &.ng-animate-disabled, &._mat-animation-noopable {
.mat-slider-track-fill,
.mat-slider-track-background,
.mat-slider-ticks,
.mat-slider-thumb-container,
.mat-slider-focus-ring,
.mat-slider-thumb,
.mat-slider-thumb-label,
.mat-slider-thumb-label-text,
.mat-slider-has-ticks .mat-slider-wrapper::after {
transition: none;
}
}
}