Description
Reproduction
https://stackblitz.com/edit/components-issue-asjy3a
Steps to reproduce:
- Add a provider for MAT_RIPPLE_GLOBAL_OPTIONS that disabled ripples, e.g.
@Injectable({providedIn: 'root'})
export class AppGlobalRippleOptions implements RippleGlobalOptions {
disabled: boolean = true;
}
- Include a Material Component that uses MatRipple, but doesn't disable them via the component input (e.g. MatButton).
Expected Behavior
When Ripples are globally disabled, elements containing a MatRipple should not have event listeners attached to the target elements.
Actual Behavior
Even when Ripples are globally disabled via a MAT_RIPPLE_GLOBAL_OPTIONS Provider, elements with MatRipples will have six click/touch listeners attached. These listeners are not themselves problematic, but when many components are present on the page represent a significant performance hit.
It looks like the last work done on this was in #11865. I discovered this issue when trying to enable and disable ripples at runtime as described in the documentation (as a means to further improve initial page load performance (a surprising amount of time is consumed setting up these 6 event listeners per element).
Environment
- Angular: 7.2.3
- CDK/Material: 7.3.0
- Browser(s): n/a (All)
- Operating System (e.g. Windows, macOS, Ubuntu): n/a (All)