Hello,
I’ve been playing around with Google Lighthouse for several years now. I am very adept at making pages have good Google Page Speed scores.
I’ve run into an issue, which seems to be the same sort of issue Elementor sites have. I noticed if you use a ‘template’ element above the fold, there is a higher chance of having CLS. I believe this is because inside the template there may have be many different CSS used, such as on the ID level, plus class level, plus framework level.
It seems the CSS are loaded separately (external files) and have a minor network delay compared to having the actual internals of the template directly onto a page.
Are there any work around for this? Or is it simply commonly accepted to not have a template elements above the fold? I guess it may be subject to what you are putting inside the template element, but even so, the CSS loading and delays probably function the same regardless.
I’ve run tests:
- Elements from template loaded directly onto the page - best result 0.002 layout shift.
- Template element above the fold - medium result - 0.162 layout shift.
- Template with conditional logic being told where to load using the after header hook - worse result - 1.162 layout shift.
My conclusion is that we probably should not use any template element above the fold.
Or are there any special options for loading the CSS better to avoid these layout shift?
Thanks
Michael