components icon indicating copy to clipboard operation
components copied to clipboard

sidenav CSS should use will-change: transform

Open iuliust opened this issue 9 years ago • 10 comments

Bug, feature request, or proposal:

Sidenav should use will-change: transform in order to remove jank where possible

What is the expected behavior?

sidenavs should have their own rendering layer

What are the steps to reproduce?

just use a sidenav and look at its CSS properties

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

sidenavs can be laggy on their first animation

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

all

iuliust avatar Jan 02 '17 12:01 iuliust

There are a lot of tips about the use of will-change. See here

will-change should be only applied if the page is not performing well and shouldn't be used on many elements.

Since we aren't able to figure out if your page is performing well, I would say that developers should apply the will-change on their own.

Also the md-sidenav should already have its own layer, since it's using transform3d

devversion avatar Jan 02 '17 13:01 devversion

There definitely are some occasional frame drops when opening a sidenav, but I'm not sure that it's because of the transform.

crisbeto avatar Jan 02 '17 15:01 crisbeto

Yep, I got frame drops too, even with a hello world. Maybe it would go away if I used AOT, although Chrome is supposed to drive animations on a separate process I believe... I had noticed the translateZ(0px), but it's kind of a hack. It's not as explicit as will-change: transform.

I know you're not supposed put tons of separate rendering layers in a page, but we can be almost sure that 99.99% of the time, there will be at most 2 sidenavs. That's just two layers. It's not like if it were 50... No ?

iuliust avatar Jan 03 '17 11:01 iuliust

@iuliust That's true. I will take a look at the performance of the sidenav and keep you updated.

devversion avatar Jan 03 '17 11:01 devversion

If this is something that the user should apply themselves, it should be part of the overview doc.

jelbourn avatar Jan 04 '17 00:01 jelbourn

Yeah good idea. We still need to evaluate whether the will-change should be applied by default or not. Thoughts on this @jelbourn?

devversion avatar Jan 04 '17 00:01 devversion

I'm not sure that the transform is to blame here. It might be better to spend some time investigating it instead.

crisbeto avatar Jan 04 '17 00:01 crisbeto

For sure, transform3d should already elevate the md-sidenav into its own rendering layer.

devversion avatar Jan 04 '17 00:01 devversion

The jank was caused by continually setting the width on every change detection, it should be fixed now.

mmalerba avatar Nov 22 '17 00:11 mmalerba

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.