Skip to content
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

Progress bar/spinner animations with NoopAnimationsModule #15713

Open
bennyboer opened this issue Apr 4, 2019 · 5 comments
Open

Progress bar/spinner animations with NoopAnimationsModule #15713

bennyboer opened this issue Apr 4, 2019 · 5 comments
Labels
animation This issue is related to Angular animations or CSS animations area: material/progress-bar needs: discussion Further discussion with the team is needed before proceeding P4 A relatively minor issue that is not relevant to core functions

Comments

@bennyboer
Copy link

What is the expected behavior?

I expect progress bar and spinner animations to still work even when the NoopAnimationsModule is imported.

What is the current behavior?

Animations are commonly disabled using the NoopAnimationsModule in order to gain additional performance especially on mobile devices. Still progress spinners (indeterminate) and bars do not make sense without animation.
As mentioned under the pull request which disabled the animations, it might make sense to import the NoopAnimationsModule for e2e and screenshot tests. But wouldn't it make sense to rather introduce a hidden switch for that especially for those tests instead of turning off animations completely?

What are the steps to reproduce?

Use mat-spinner with NoopAnimationsModule imported.

See StackBlitz example

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular & Angular Material 7

@maic333
Copy link

maic333 commented Apr 12, 2019

You can use the injection token MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS, providing it with different configuration in the module where you need it (or globally in AppModule), e.g.:

import { MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS } from '@angular/material';

@NgModule({
    ...
    providers: [
        {
            provide: MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,
            useValue: {
                _forceAnimations: true
            }
        }
    ],
    ...
})
export class AppModule {
}

Check the docs for all the available configuration params: https://material.angular.io/components/progress-spinner/api#interfaces

@bennyboer
Copy link
Author

@maic333 Yes, that's the solution I am currently using, though it is unavailable for progress bars.

@mmalerba mmalerba added needs: discussion Further discussion with the team is needed before proceeding and removed discussion labels Mar 3, 2020
@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@josephperrott josephperrott removed their assignment May 27, 2020
@josephperrott josephperrott added animation This issue is related to Angular animations or CSS animations P4 A relatively minor issue that is not relevant to core functions and removed needs triage This issue needs to be triaged by the team labels May 27, 2020
@vinod-amt
Copy link

@maic333 Yes, that's the solution I am currently using, though it is unavailable for progress bars.

yes, not available for progress bars. any work around?

@alperozhan
Copy link

actually @maic333's solution works with @angular/material 11.0.0 in my case.

@k290
Copy link

k290 commented Sep 13, 2023

This would be a useful fix as we use NoopAnimations to disable animations only in some places in our software

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animation This issue is related to Angular animations or CSS animations area: material/progress-bar needs: discussion Further discussion with the team is needed before proceeding P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

8 participants