-
AuthorPosts
-
March 3, 2021 at 11:06 am #1284981
Thinking about it and reading to documentation about CLS shift.
If the text and newsletter sign up boxes are taller than the min-height set in the colour section background element then the box will re-size to suit as the elements load. This will cause a perceived layout shift.
You can set a min-height for mobiles in the Colour Section Element. Try increasing it and see if that makes a difference.Otherwise:
Try using @media queries to change the min-height of the Colour Section behind your header for different screen size. This may reduce the layout shift.You can also serve a different sized background image depending on the device using CSS. Serving a different sized image will improve the FCP score as a smaller image can be served to suit the screen size.
Once the new version of Enfold arrives I’ll be experimenting and implementing a full solution to this across all of my customers sites. I use the background element ALOT in Enfold header sections.
March 4, 2021 at 1:15 am #1285182Hey thinkjarvis,
this CLS is occouring also to all of my blog posts, which i’m editing with gutenberg, so i don’t have placed any color sections.
I’m wondering because i don’t made any changes since my last inquery for the high CLS.
If the text and newsletter sign up boxes are taller than the min-height set in the colour section background element then the box will re-size to suit as the elements load. This will cause a perceived layout shift.
I don’t know exactly how i can implement what you are suggesting. Do you have some custom css?
Here is one of my blogposts: https://www.freitauchen-lernen.com/rekord-luft-anhalten/
Best regards and thanks alot
March 5, 2021 at 12:38 pm #1285703@freediver2011
I’ve just cracked this on my website. https://www.thinkjarvis.co.uk Full pass on Lighthouse in Chrome 93/100. (just depending on server response time).Right where to start. Please read the following very carefully.
@Ismael – Please can you use this as a basis for a fix for @freediver2011
The background element needs a fixed height on mobiles to reduce the CLS to an acceptable level.The min-height box for ALB elements is controlled by data classes – JS not CSS.
The opacity layer, and all of the containers within the slideshow or ALB colour section therefore have no fixed height.
The JS is applied after the CSS therefore causing a layout shift. So as a workaround you have to specify heights and widths of the elements that make up the box.The background images in colour sections and slider images, captions and everything else have no set height and width. They have min-height and min-width. Therefore they shift when it renders the page.
Note – ALB sliders are currently more efficient than Background images – This is because it serves scaled images. You have to add some extra @media queries manually to optimise ALB colour section background images. Tutorial to follow when I get time.
For my site the appropriate min-height for mobiles is 351px So I entered this into the box in the style section.
I then added the following code.
This workaround is for full width easy sliders as per my website. But can be adapted for background colour sections using the same logic. I will share a solution once I have applied it to another site on my server for testing
Set a custom ID for the first element on the page.
#tj-fade-remove
Removes animations on mobiles (note there is some overlap in these bits. I need to refine it a bit more).
This drastically improves LCP by 5 seconds and a pass mark in lighthouse./* Removes animations on first element/ Slider on mobiles only */ /* Removes animations on slider titles and caption */ @media only screen and (max-width: 767px) { #tj-fade-remove .avia-caption-title, .avia-caption-content, .avia-slideshow-button { -webkit-animation: 0s ease 0s normal none 1 running none !important; animation: 0s ease 0s normal none 1 running none !important; visibility: visible !important; } /* Removes animations on slider titles and caption */ #tj-fade-remove .container { -webkit-transition: opacity 0s; transition: opacity 0s; } #tj-fade-remove .avia_transform .av_slideshow_full.avia-fade-slider .active-slide .avia-caption-title { -webkit-animation: 0s ease 0s normal none 1 running none !important; animation: 0s ease 0s normal none 1 running none !important; visibility: visible !important; transform: none !important; -webkit-transition: opacity 0s; transition: opacity 0s; } /* Disables some JS use with caution this will remove buttons and the main header from slideshow captions */ .js_active .avia-slideshow li:first-child { visibility: visible!important; transform: translateZ(0px) !important; -webkit-transition: none !important; } }
Note – I removed the opacity settings and just applied opacity to the image directly. Therefore reducing render time.
/* Applies fixed height for mobiles based on content */ @media only screen and (max-width: 767px) { #tj-fade-remove { height:351px !important; } /* Applies fixed height and width to image based on enfold min values and offset */ #tj-fade-remove img { height:351px !important; min-width: 762px; left: -201px; } }
I hope this helps others. I have one last bit to add to my setup which is serving Google Analytics locally.
I have actually disabled Jetpack Lazy Load and Photon as this seems to have improved the score rather than reducing it!- This reply was modified 3 years, 9 months ago by thinkjarvis. Reason: spelling error
March 9, 2021 at 2:41 pm #1286739Wow thinkjarvis,
i appreciate your work a lot. Really! Thank you very much.
I’m a little bit struggeling at this:
Set a custom ID for the first element on the page.
I can give images an custom css class, but i think, this is not, what you mentioned. I’m sorry for my moderate technical knowledge about this.
And what is the first element on the page (header, menu, blog post title, featured image)?
Sorry for these really beginner questions :(
Warm greetings
SebastianMarch 11, 2021 at 9:14 am #1287334Hi Sebastian,
I’m very sorry for the late reply. If you need to give an ID to the first header on the blog post you linked to, then you will have to use the Layout Builder and add a Special Heading element. You can add the ID in the Advanced tab in the element options. It looks like you are currently not using the layout builder to create your posts, that means that the title header will be generated automatically, and you won’t have the option to add an ID to it.
Best regards,
RikardMarch 11, 2021 at 11:02 am #1287374@Rikard
Correct me if I am wrong
The layout shift is caused by the first Color section on the home page. He needs a solution similar to the one I have suggested to prevent the layout shift.Something is amiss in the settings for the first color section on the home page. I would suggest that the element either has no min-height or a min-height that is too small meaning that when the content within the color section loads in, it shifts the entire page downwards.
March 11, 2021 at 12:14 pm #1287395Good morning guys,
i think you are wrong thinkjarvis. Maybe i wasn’t clearly enough.
The CLS doesn’t occur from the first color section from my home page.
I wrote, that the main impact came from several modules out of the cookie consent message on all of my blog post.In total the CLS is over 0,2 mainly from several cookie elements, cookie box:
1. Diese Webseite verwendet Cookies zur Webseitenverbesserung. Wenn Du diese Webse…<div class=”container”> 0,125
2. Mehr erfahren / More information Button 0,047
3. Ok Button 0,035
….As an example i gave this post: https://www.freitauchen-lernen.com/rekord-luft-anhalten/
Hope this is better for clarity.
Best regards
Sebastian- This reply was modified 3 years, 9 months ago by Freediver2011.
March 11, 2021 at 12:53 pm #1287407Sorry I missunderstood your question.
However – Run Lighthouse on your home page. The first element is causing a massive CLS on mobiles.Sorry I’ve possibly given you more work to do!
-
AuthorPosts
- You must be logged in to reply to this topic.