Skip to content

Commit e62a8a9

Browse files
committed
Revert "fix(checkbox): disable animations when using NoopAnimationsModule (#11249)"
This reverts commit 6515d9c.
1 parent 81a2d59 commit e62a8a9

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

src/lib/checkbox/checkbox.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
@import '../core/style/checkbox-common';
44
@import '../core/ripple/ripple';
55
@import '../core/style/layout-common';
6-
@import '../core/style/noop-animation';
76

87
// Manual calculation done on SVG
98
$_mat-checkbox-mark-path-length: 22.910259;
@@ -180,8 +179,6 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
180179
}
181180

182181
.mat-checkbox {
183-
@include _noop-animation();
184-
185182
// Animation
186183
transition: background $swift-ease-out-duration $swift-ease-out-timing-function,
187184
mat-elevation-transition-property-value();
@@ -237,10 +234,6 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
237234
width: $mat-checkbox-border-width;
238235
style: solid;
239236
}
240-
241-
._mat-animation-noopable & {
242-
transition: none;
243-
}
244237
}
245238

246239
.mat-checkbox-background {
@@ -252,10 +245,6 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
252245
transition: background-color $mat-checkbox-transition-duration
253246
$mat-linear-out-slow-in-timing-function,
254247
opacity $mat-checkbox-transition-duration $mat-linear-out-slow-in-timing-function;
255-
256-
._mat-animation-noopable & {
257-
transition: none;
258-
}
259248
}
260249

261250
.mat-checkbox-checkmark {

src/lib/checkbox/checkbox.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {
3939
RippleRef,
4040
} from '@angular/material/core';
4141
import {MAT_CHECKBOX_CLICK_ACTION, MatCheckboxClickAction} from './checkbox-config';
42-
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
4342

4443

4544
// Increasing integer for generating unique ids for checkbox components.
@@ -109,7 +108,6 @@ export const _MatCheckboxMixinBase =
109108
'[class.mat-checkbox-checked]': 'checked',
110109
'[class.mat-checkbox-disabled]': 'disabled',
111110
'[class.mat-checkbox-label-before]': 'labelPosition == "before"',
112-
'[class._mat-animation-noopable]': `_animationMode === 'NoopAnimations'`,
113111
},
114112
providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
115113
inputs: ['disableRipple', 'color', 'tabIndex'],
@@ -186,8 +184,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
186184
private _focusMonitor: FocusMonitor,
187185
@Attribute('tabindex') tabIndex: string,
188186
@Optional() @Inject(MAT_CHECKBOX_CLICK_ACTION)
189-
private _clickAction: MatCheckboxClickAction,
190-
@Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string) {
187+
private _clickAction: MatCheckboxClickAction) {
191188
super(elementRef);
192189

193190
this.tabIndex = parseInt(tabIndex) || 0;
@@ -325,11 +322,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
325322
if (!this._focusRipple && focusOrigin === 'keyboard') {
326323
this._focusRipple = this.ripple.launch(0, 0, {persistent: true});
327324
} else if (!focusOrigin) {
328-
if (this._focusRipple) {
329-
this._focusRipple.fadeOut();
330-
this._focusRipple = null;
331-
}
332-
325+
this._removeFocusRipple();
333326
this._onTouched();
334327
}
335328
}
@@ -397,11 +390,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
397390

398391
private _getAnimationClassForCheckStateTransition(
399392
oldState: TransitionCheckState, newState: TransitionCheckState): string {
400-
// Don't transition if animations are disabled.
401-
if (this._animationMode === 'NoopAnimations') {
402-
return '';
403-
}
404-
405393
let animSuffix: string = '';
406394

407395
switch (oldState) {
@@ -432,4 +420,12 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
432420

433421
return `mat-checkbox-anim-${animSuffix}`;
434422
}
423+
424+
/** Fades out the focus state ripple. */
425+
private _removeFocusRipple(): void {
426+
if (this._focusRipple) {
427+
this._focusRipple.fadeOut();
428+
this._focusRipple = null;
429+
}
430+
}
435431
}

0 commit comments

Comments
 (0)