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

Md-Sidenav open mode bootstrap animation #6865

Closed
ghost opened this issue Sep 6, 2017 · 9 comments · Fixed by #8828
Closed

Md-Sidenav open mode bootstrap animation #6865

ghost opened this issue Sep 6, 2017 · 9 comments · Fixed by #8828
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent regression This issue is related to a regression
Milestone

Comments

@ghost
Copy link

ghost commented Sep 6, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When using universal, the sidenav (in side mode) will be rendered already open in the initial page load, and then when the app bootstraps, it will stay open.

What is the current behavior?

The initial pre-rendered page loads with the sidenav closed, and then when the app boostraps, the sidenav animates open.

What is the use-case or motivation for changing an existing behavior?

In beta 8, it worked perfectly. The initial pre-rendered html file aligned with the bootstrap re-render.
Now, the page loads with the sidenav closed, and after a number of seconds later (when the app bootstraps) the sidenav suddenly animates open, which is quite distracting.

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

Angular 4.3.3, material 2.0.0-beta8, windows 10

@CaerusKaru
Copy link
Member

CaerusKaru commented Sep 30, 2017

The problem here is actually deeper than anticipated. See here:

https://github.com/angular/material2/blob/20a23f16e8ac1ced29172709cc837fa500b6377b/src/lib/sidenav/drawer.ts#L347-L350

https://github.com/angular/material2/blob/20a23f16e8ac1ced29172709cc837fa500b6377b/src/lib/sidenav/drawer.ts#L553-L585

Since the margins for the mat-drawer-content depend on elements that haven't been rendered yet, Universal can't possibly predict the width, leaving it static at 0, and populated on bootstrap on the client. The "animation" is really just the transition CSS firing once the width is populated. At least that's my theory, it all depends on how Angular (and Universal) constructs the application in order (since I think Universal just gives it one go)

@mmalerba Is there a possible refactoring we can do here, maybe by searching the element tree for CSS width if none other is available?

@CaerusKaru
Copy link
Member

As documented in #7795, there's also an issue with transform: translate3d(0,0,0) not being applied correctly.

@CaerusKaru
Copy link
Member

There's also currently an issue open angular/angular#19235 that is tracking an issue with style.property not being applied correctly if the property name is in camelCase (in drawer, this is marginRight and marginLeft).

@mmalerba mmalerba added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent regression This issue is related to a regression labels Nov 21, 2017
@mmalerba mmalerba added this to the 5.0 milestone Nov 21, 2017
@mmalerba
Copy link
Contributor

should be fixed by #8488

@CaerusKaru
Copy link
Member

@mmalerba Issue not resolved by #8488

@crisbeto crisbeto self-assigned this Dec 5, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 5, 2017
Prevents drawers that are open by default from animating on init if they're rendered on the server.

Fixes angular#6865.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 5, 2017
Prevents drawers that are open by default from animating on init if they're rendered on the server.

Fixes angular#6865.
mmalerba pushed a commit that referenced this issue Dec 5, 2017
)

Prevents drawers that are open by default from animating on init if they're rendered on the server.

Fixes #6865.
@CaerusKaru
Copy link
Member

@crisbeto Still not fixed

@algcifaldi
Copy link

As far as I can tell, this is still happening in the latest release. Is #8969 the new issue to track for status updates?

@agustinhaller
Copy link

Hi, any updates on this? In my case it was working OK with Angular 5.0.2 and material 5.0.0.rc0 but stop working when updated to Angular 5.2.8 and material 5.2.4

@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent regression This issue is related to a regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants