Skip to content

Commit 1c671dc

Browse files
committed
fix(material-experimental/mdc-list): align ripple timings with MDC
Uses the ripple timing values from MDC for our implementation so that it's consistent with the spec.
1 parent 4f8e87e commit 1c671dc

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/material-experimental/mdc-list/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ng_module(
3333
"@npm//@angular/core",
3434
"@npm//@angular/forms",
3535
"@npm//@material/list",
36+
"@npm//@material/ripple",
3637
],
3738
)
3839

@@ -91,6 +92,7 @@ ng_test_library(
9192
ng_web_test_suite(
9293
name = "unit_tests",
9394
static_files = [
95+
"@npm//:node_modules/@material/ripple/dist/mdc.ripple.js",
9496
"@npm//:node_modules/@material/list/dist/mdc.list.js",
9597
],
9698
deps = [

src/material-experimental/mdc-list/list-base.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
RippleTarget,
3030
setLines,
3131
} from '@angular/material-experimental/mdc-core';
32+
import {numbers} from '@material/ripple';
3233
import {Subscription} from 'rxjs';
3334
import {startWith} from 'rxjs/operators';
3435
import {MatListAvatarCssMatStyler, MatListIconCssMatStyler} from './list-styling';
@@ -92,7 +93,14 @@ export abstract class MatListItemBase implements AfterContentInit, OnDestroy, Ri
9293
@Optional() @Inject(MAT_RIPPLE_GLOBAL_OPTIONS)
9394
globalRippleOptions?: RippleGlobalOptions) {
9495
this._hostElement = this._elementRef.nativeElement;
95-
this.rippleConfig = globalRippleOptions || {};
96+
this.rippleConfig = {...(globalRippleOptions || {})};
97+
98+
if (!this.rippleConfig.animation) {
99+
this.rippleConfig.animation = {
100+
enterDuration: numbers.DEACTIVATION_TIMEOUT_MS,
101+
exitDuration: numbers.FG_DEACTIVATION_MS
102+
};
103+
}
96104

97105
if (!this._listBase._isNonInteractive) {
98106
this._initInteractiveListItem();

0 commit comments

Comments
 (0)