IsHidden() causes a forced reflow
See original GitHub issueThere’s probably something about the getComputedStyle
that forces the browser to reflow, creating a performance bottleneck.
https://gist.github.com/paulirish/5d52fb081b3570c81e3a#calling-getcomputedstyle
I wonder if there could be an alternative?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
getComputedStyled() causes a forced reflow #115 - GitHub
This change is a breaking change and in my opinion there are cases where focusable elements have zero size, like skip to main...
Read more >"Force Reflow" in CSS transitions in Bootstrap - Stack Overflow
To me, it seems that in certain situations, the styles written to the dom are being buffered somewhere and not being flushed. That's...
Read more >What is a Forced Reflow and How to Solve it? - Yonatan Kra
Force reflow (or Layout Reflow) is a major performance bottleneck. It happens when a measurement of the DOM happens after a DOM mutation....
Read more >Transitioning Hidden Elements - Cloud Four
Hidden elements can not be transitioned since they're not in the document flow. However, we can get around this by forcing the document...
Read more >Minimizing browser reflow | PageSpeed Insights
Here are some easy guidelines to help you minimize reflow in your web pages: Reduce unnecessary DOM depth. Changes at one level in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The next publish of this library will update tabbable to 5.2.0, which will give focus-trap the ability to pass the new
displayCheck
option down to tabbable, which could help mitigate this issue. However, this could open a can of worms for focus-trap as I noted in #362. Comments welcome.I see this in Chrome 86 on MacOS 10.15.7, and in Edge 84 on Windows 10 (in a VM).
I’m experiencing the same issue and interested in investigating an optimization here. In my case, an extremely large
document
exacerbates the problem: Each forced layout takes 600+ms. Removing the need for this recalculation would halve the execution time of my callback.