fix(EMI-3113): Layout shift on checkout load#16904
Open
erikdstock wants to merge 2 commits intomainfrom
Open
Conversation
Two causes were found and fixed: 1. LayoutCheckout wrapped NavBarPrimaryLogo in a RouterLink, but NavBarPrimaryLogo already renders its own RouterLink internally. This produced a nested <a> inside <a>, which browsers silently auto-correct in SSR HTML but React's virtual DOM does not expect, causing a hydration failure that remounted the entire layout on every checkout page load — the primary source of the visible shift. 2. The scroll lock (overflow: hidden) during skeleton loading hid the scrollbar, then when the lock released and real content appeared the scrollbar reappeared, shifting all content 15px horizontally. Fixed by padding the body by the scrollbar width while locked so both changes cancel out with no net layout shift on unlock. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#7090 Bundle Size — 8.66MiB (~+0.01%).cca797e(current) vs dbd9ca2 main#7083(baseline) Warning Bundle contains 31 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch erik.checkout-loading-shift Project dashboard Generated by RelativeCI Documentation Report issue |
0b5fab9 to
cca797e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The type of this PR is: fix
This PR solves EMI-3113
Description
This PR fixes 2 layout shifts that happen during checkout loading - the first a hydration error and the second due to our scroll locking behavior, which causes the scroll bar to hide and then pop in, squishing the viewport width.