Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

fix: Hero layout shift #472

Merged
merged 2 commits into from Apr 11, 2022
Merged

fix: Hero layout shift #472

merged 2 commits into from Apr 11, 2022

Conversation

tlgimenes
Copy link
Contributor

What's the purpose of this pull request?

We were having issues with this component on the PLP when removing the PostalCodeInput component. This can be seen in here: https://github.com/vtex-sites/storeframework.store/pull/46

This issue was fixed after we did the changes described on this PR in here: https://github.com/vtex-sites/storeframework.store/pull/46/commits/6efa3ccfb9f794be2bd44bc219ef3b7606876177

Having that said, I propose merging this fix in here so we don't have to deal with it in the future.

How does it work?

This PR inverts the rendering order to match the render on mobile. This fixes CLS. To avoid rendering the incorrect order, the flex display was also inverted. This fixed the Layout Shift regions on lighthouse report.

How to test it?

Make sure nothing changed and that the layout shift was fixed in: https://github.com/vtex-sites/storeframework.store/pull/46

Checklist

  • CHANGELOG entry added

@vtex-sites
Copy link

vtex-sites bot commented Apr 9, 2022

Preview is ready

This pull request generated a Preview

👀   Preview: https://preview-472--base.preview.vtex.app
🔬   Go deeper by inspecting the Build Logs
📝   based on commit 540819b

@gatsby-cloud
Copy link

gatsby-cloud bot commented Apr 9, 2022

Gatsby Cloud Build Report

basestore

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 2m

Performance

Lighthouse report

Metric Score
Performance 💚 98
Accessibility 💚 100
Best Practices 💚 93
SEO 💚 93

🔗 View full report

@tlgimenes tlgimenes requested a review from a team April 9, 2022 16:06
Copy link
Contributor

@renatamottam renatamottam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

Copy link
Contributor

@filipewl filipewl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting! It hadn't come to me that little things such as CSS re-ordering could affect CLS, but it makes perfect sense now.

Before After
Screen Shot 2022-04-10 at 08 42 16 Screen Shot 2022-04-10 at 08 42 20

Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! 👏
I was trying to investigate this CLS on another PR. Good to know that the flex order is affecting it :)

@tlgimenes tlgimenes merged commit 540819b into master Apr 11, 2022
@tlgimenes tlgimenes deleted the fix/cls branch April 11, 2022 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants