Feature Request
Ability to disable slide in animation for tabs
Tab content currently slides in when a new tab is selected. It would be helpful to add an input option to disable this animation
https://material.angular.io/components/tabs/examples
https://stackblitz.com/edit/angular-material2-issue-7aucx8?file=app%2Fapp.component.html
The tabs can be distracting for certain audiences or circumstances.
Angular material: 6.4.6
Usually you can just disable all animations by using the NoopAnimationsModule, but I assume you don't want to disable all animations of the application though?
For the remaining tab parts which still animate with the NoopAnimationsModule applied, there is a PR pending (see https://github.com/angular/material2/pull/11395)
In this case, we want to disable just the slide animation.
@DevVersion Using NoopAnimationsModule can be a problem sometimes, e.g. if you want to conditionally disable animations during runtime, or if you can't deploy a second animation-free build.
Do you know if that PR will make the @.disabled binding correctly disable the animation?
@kekraft @GitSage That makes sense. Using @.disabled binding will partly work and only disable the content slide animation (for now; which is what you expect right now).
My plan is to also disable animations for the inkbar etc. if @.disabled is specified.
See here: https://stackblitz.com/edit/angular-ns4vi5?file=app/tab-group-basic-example.html
The problem with @.disabled is that it disables animations for all child components too. I currently have an expansion panel underneath a tab and I need the animation for that but not the tab. Any way to solve that conundrum?
@patoncrispy The documentation has this to say:
Overriding disablement of inner animations
Despite inner animations being disabled, a parent animation can query() for inner elements located in disabled areas of the template and still animate them if needed. This is also the case for when a sub animation is queried by a parent and then later animated using animateChild().
Alternatively, you could try setting @.disabled="true" on a parent and then setting @disabled="false" on the child. I'm not sure if that would work though. I haven't checked that myself yet though.
@GitSage ".disabled="false" doesn't work. Also, I think to use animateChild requires you to know the animation triggered. Also, that shouldn't be a solution. As mentioned before, it should be simple enough to add a property to disable animations on components without having to hack away.
I've been looking at this as well. There is no option to disable the sliding in animation. I've worked around it by hooking into the start and stop events. What makes it worse is that the actual site uses a better tab transition than any in the api.
@fookensoul , can you share a bit more detail about your workaround?
See issue #13428 and PR #13505. The option is already there. This bug can be closed.
Closing since the option for controlling the animation duration is in master.
Hey @crisbeto the animationDuration is not yet available for Tabs on 7.04 right?
It should be in 7.1.0.
Nice! Thank you @crisbeto.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@kekraft @GitSage That makes sense. Using
@.disabledbinding will partly work and only disable the content slide animation (for now; which is what you expect right now).My plan is to also disable animations for the inkbar etc. if
@.disabledis specified.See here: https://stackblitz.com/edit/angular-ns4vi5?file=app/tab-group-basic-example.html