[Support request] SVG causing CLS movement

Home Forums Support [Support request] SVG causing CLS movement

Home Forums Support SVG causing CLS movement

Viewing 15 posts - 16 through 30 (of 30 total)
  • Author
    Posts
  • #1547060
    Elvin
    Staff
    Customer Support

    Hi,

    I’ve ran your site through GTMetrix and PageSpeed insight and I don’t see the CLS issue on the logo anymore.

    GTMetrix – https://gtmetrix.com/reports/bookanalysis.com/T4cL9gSr/
    Google PSI – https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fbookanalysis.com%2F&tab=desktop

    The results will vary on different test but I’ve ran the test 5 times on each and there were no reports flagging the logo w/ CLS issue.

    Can you verify on your end? Thank you.

    #1547964
    William

    Ah yes you are right – I’ve just enabled WP Rocket and EWWW image optimizer and the CLS increases again though, even with your code added from David etc.

    #1547965
    William

    I think the issue for CLS is this:

    For a split second, the header appears without the image, which makes a small CLS appear when the image appears.

    With this, is there a way to make the header the correct height for both desktop and mobile even when the logo has not loaded yet to prevent such CLS? I think that could fix the CLS issue.

    #1547970
    Elvin
    Staff
    Customer Support

    I don’t see the width and height attribute on your logo as shown here:
    https://share.getcloudapp.com/v1u4Rgr8

    Can you try purging/clearing cache?

    Can you also disable EWWW image optimizer again w/ WP Rocket enabled to see if its the one removing the img attributes? Thank you.

    #1547977
    William

    Sure thing, EWWW disabled and WP Rocket purged – any luck?

    #1548003
    Elvin
    Staff
    Customer Support

    The img width & height shows back up as shown here:
    https://share.getcloudapp.com/7KubdQWQ

    To confirm, can you enable EWWW again? You can actually do the check yourself by right-clicking the page and clicking “Inspect”. https://share.getcloudapp.com/nOuDwR7r

    Let us know. 😀

    #1548054
    William

    Yup you’re completely right – EWWW is causing the issue. I can’t see any option to stop them from tinkering with the image though.

    #1548061
    Elvin
    Staff
    Customer Support

    Yup you’re completely right – EWWW is causing the issue. I can’t see any option to stop them from tinkering with the image though.

    I’m not exactly sure if they have a feature that excludes specific images from being affected by this.

    Its best to check their documentation or ask their support about this.

    #1548071
    William

    I think you’re right on this.

    Thank you sooo much for your guys help. I am actually in the process of thinking of going to a new theme for another site of mine, and skeptical due to their lack of clear and good support. It’s just another reason to get the site on GP!

    #1550586
    Elvin
    Staff
    Customer Support

    No problem. 😀

    #1561475
    William

    Hi there,
    So I’ve spoken to the developer an fixed the issue! However, there is still a little CLS movement because when the image has not loaded, the header for desktop and mobile is a certain height, and then when the logo loads, the header increases in height to accommodate the logo.

    Are you able to provide some CSS to prevent this shift from happening?

    Many thanks,

    Will

    #1562043
    Tom
    Lead Developer
    Lead Developer

    Try giving the logo a set height:

    .site-header .header-image {
        height: 97px;
    }

    If you switch to our Flexbox structure, we add the logo dimensions directly to the HTML automatically: https://docs.generatepress.com/article/switching-from-floats-to-flexbox/

    #1562378
    William

    Hi there,
    I’ve added the above CSS and that seems to fix the issue, thanks! On moving to flex, though, I notice my search bar is appearing in a different area than before for desktop and primary navigation buttons appear slightly different on mobile? How would these be pushed back to the right positions in flex if that is the better choice for the theme?

    #1562417
    William

    You can see the site on flex on a sandbox here compared to the live site here.

    #1562564
    Elvin
    Staff
    Customer Support

    The search bar moves slightly to the right because the “Books” and “Authors” buttons have less width on your staging site because they do not have icons.

    Adding this buttons should replicate the same appearance you have with the non-flexbox live site.

    As for the mobile view:

    try adding this:


    @media
    (max-width:768px){
    /* Remove margin that pushes the buttons to the right on mobile */
    .nav-float-right #site-navigation {
    margin-left: unset;
    }
    /* adds 20px margin to replicate floats spacing */
    .inside-header>:not(:last-child):not(.main-navigation) {
    margin-bottom: 20px;
    }
    /* adds 20px margin to replicate floats spacing */
    .inside-header .header-widget {
    margin-bottom: 20px;
    }
    }

Viewing 15 posts - 16 through 30 (of 30 total)
  • You must be logged in to reply to this topic.