Skip to content

fix(material-experimental/mdc-list): align ripple timings with MDC #22396

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

Merged
merged 1 commit into from
Apr 7, 2021
Merged
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
2 changes: 2 additions & 0 deletions src/material-experimental/mdc-list/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ng_module(
"@npm//@angular/core",
"@npm//@angular/forms",
"@npm//@material/list",
"@npm//@material/ripple",
],
)

Expand Down Expand Up @@ -92,6 +93,7 @@ ng_web_test_suite(
name = "unit_tests",
static_files = [
"@npm//:node_modules/@material/list/dist/mdc.list.js",
"@npm//:node_modules/@material/ripple/dist/mdc.ripple.js",
],
deps = [
":list_tests_lib",
Expand Down
13 changes: 12 additions & 1 deletion src/material-experimental/mdc-list/list-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
RippleTarget,
setLines,
} from '@angular/material-experimental/mdc-core';
import {numbers} from '@material/ripple';
import {Subscription} from 'rxjs';
import {startWith} from 'rxjs/operators';
import {MatListAvatarCssMatStyler, MatListIconCssMatStyler} from './list-styling';
Expand Down Expand Up @@ -91,8 +92,18 @@ export abstract class MatListItemBase implements AfterContentInit, OnDestroy, Ri
private _listBase: MatListBase, private _platform: Platform,
@Optional() @Inject(MAT_RIPPLE_GLOBAL_OPTIONS)
globalRippleOptions?: RippleGlobalOptions) {
// We have to clone the object, because we don't want to mutate a global value when we assign
// the `animation` further down. The downside of doing this is that the ripple renderer won't
// pick up dynamic changes to `disabled`, but it's not something we officially support.
this.rippleConfig = {...(globalRippleOptions || {})};
this._hostElement = this._elementRef.nativeElement;
this.rippleConfig = globalRippleOptions || {};

if (!this.rippleConfig.animation) {
this.rippleConfig.animation = {
enterDuration: numbers.DEACTIVATION_TIMEOUT_MS,
exitDuration: numbers.FG_DEACTIVATION_MS
};
}

if (!this._listBase._isNonInteractive) {
this._initInteractiveListItem();
Expand Down
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ng_web_test_suite(
name = "unit_tests",
static_files = [
"@npm//:node_modules/@material/list/dist/mdc.list.js",
"@npm//:node_modules/@material/ripple/dist/mdc.ripple.js",
],
deps = [
":unit_tests_lib",
Expand Down