-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[feat] ripples: dynamically enable/disable all interaction ripples #9729
Comments
Quick follow up: I applied the workaround mentioned in #8298 (comment)
Which already improves performance on low-end devices. I like that it still highlights something the user touches which is a lot better than having no feedback at all just because of performance issues. Maybe the workaround is suitable as an "official" low-performance device workaround? |
Dynamically modifying the global ripple options is already partially working (except for chips & tab-nav-bar). app.module.ts @NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
MyMaterialModule,
],
declarations: [HomeComponent],
bootstrap: [HomeComponent],
providers: [
// Alias the ripple global options to an existing provider instance (singleton; at root)
{ provide: MAT_RIPPLE_GLOBAL_OPTIONS, useExisting: AppRippleOptions }
]
})
export class AppModule {} app-ripple-options.ts import {RippleGlobalOptions, RippleAnimationConfig} from '@angular/material';
import {Injectable} from '@angular/core';
@Injectable({providedIn: 'root'})
export class AppRippleOptions implements RippleGlobalOptions {
/**
* Whether ripples should be disabled. Ripples can be still launched manually by using
* the `launch()` method. Therefore focus indicators will still show up.
*/
disabled: boolean;
} home.component.ts import {Component} from '@angular/core';
import {AppRippleOptions} from './app-ripple-options';
@Component({
...
})
export class HomeComponent {
constructor(private _rippleOptions: AppRippleOptions) {}
toggleRippleDisabled() {
this._rippleOptions.disabled = !this._rippleOptions.disabled;
}
} I'll be working on making this possible for the chips and tab-nav-bar as well. This is currently blocked by a deprecation until next major (7.0.0) |
* Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729
* Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729
* Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729
* Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729
) * feat(ripples): support updating global ripple options at runtime * Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes #9729 * fixup! feat(ripples): support updating global ripple options at runtime Address feedback
…ular#14705) * feat(ripples): support updating global ripple options at runtime * Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729 * fixup! feat(ripples): support updating global ripple options at runtime Address feedback
…ular#14705) * feat(ripples): support updating global ripple options at runtime * Allows updating any global ripple option at runtime. This makes it possible for developers to disable ripples at runtime. Closes angular#9729 * fixup! feat(ripples): support updating global ripple options at runtime Address feedback
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Feature request
What is the expected behavior?
Enable/Disable ripples globally at runtime.
What is the current behavior?
Ripples can be disabled globally by providing MAT_RIPPLE_GLOBAL_OPTIONS.
This is static and can't be changed at runtime.
If this assumption is wrong please show me how to dynamically change the root injectors value.
What is the use-case or motivation for changing an existing behavior?
An app that needs to run on low-end-devices as well as high-end devices. The user has the ability to disable styles and effects that degrade performance on low-end devices. This includes disabling ripples.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
The text was updated successfully, but these errors were encountered: