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

Usage of getBoundingClientRect in liquid-measured is causing forced reflow and slows down rendering #599

Open
selvaa89 opened this issue Jan 20, 2018 · 3 comments

Comments

@selvaa89
Copy link

Using getBoundingClientRect is causing forced reflow and slows down the rendering in mobile.

screen shot 2018-01-20 at 5 07 49 pm

@ef4
Copy link
Collaborator

ef4 commented Jan 20, 2018

We deliberately trigger reflow here. There is no other way to get the browser to lay out the final positions of all the elements so we can measure them.

What’s important is that we do it only the minimal number of times when data changes — not at each frame in the animation.

@selvaa89
Copy link
Author

Ok, But the component I am talking about has fixed width and fixed height and is absolute positioned.

So, Is this force reflow still required? Please forgive if my question doesn't make sense.

@ef4
Copy link
Collaborator

ef4 commented Jan 21, 2018

The only time the reflow isn't needed is when your element hasn't moved at all and there's nothing to animate, in which case the reflow is probably pretty cheap anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants