Skip to content

fix(drawer): drawer container animating when open by default #7129

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

Conversation

crisbeto
Copy link
Member

  • Prevents the drawer container from animating if it's open on load.
  • Fixes _updateStyles being called twice in a row on init, because the first animations are void->void and void->open-instant.

Fixes #7007.

@crisbeto crisbeto requested a review from mmalerba as a code owner September 17, 2017 09:17
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 17, 2017
.subscribe((event: AnimationEvent) => {
// Set the transition class on the container so that the animations occur. This should not
// be set initially because animations should only be triggered via a change in state.
if (event.toState !== 'open-instant') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._element.nativeElement.classList.toggle('mat-drawer-transition', event.toState != 'open-instant');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second param isn’t supported on IE.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, in that case can we still at least use classList.add instead of the Renderer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The renderer is SSR-friendly. AFAIK we can stop using it in Angular 5.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't animation events not fire on the server?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK they could fire if the sidenav starts off opened.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ok, just needs rebase then

@crisbeto crisbeto force-pushed the 7007/drawer-container-initial-animation branch 2 times, most recently from fc16ed9 to 537882b Compare September 30, 2017 10:20
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Sep 30, 2017
@kara
Copy link
Contributor

kara commented Oct 3, 2017

@crisbeto Fix linter failure?

@kara kara assigned crisbeto and unassigned mmalerba Oct 3, 2017
@kara kara removed the action: merge The PR is ready for merge by the caretaker label Oct 3, 2017
* Prevents the drawer container from animating if it's open on load.
* Fixes `_updateStyles` being called twice in a row on init, because the first animations are `void->void` and `void->open-instant`.

Fixes angular#7007.
@crisbeto crisbeto force-pushed the 7007/drawer-container-initial-animation branch from 537882b to 9b8968c Compare October 3, 2017 19:30
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Oct 3, 2017
@crisbeto
Copy link
Member Author

crisbeto commented Oct 3, 2017

Ready to go.

@kara kara merged commit 4d278dd into angular:master Oct 4, 2017
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(sidenav): the drawer-container is animated when initialized
4 participants