Skip to content

fix(EMI-3113): Layout shift on checkout load#16904

Open
erikdstock wants to merge 2 commits intomainfrom
erik.checkout-loading-shift
Open

fix(EMI-3113): Layout shift on checkout load#16904
erikdstock wants to merge 2 commits intomainfrom
erik.checkout-loading-shift

Conversation

@erikdstock
Copy link
Contributor

@erikdstock erikdstock commented Mar 6, 2026

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.

erikdstock and others added 2 commits March 6, 2026 14:29
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>
@erikdstock erikdstock self-assigned this Mar 6, 2026
@erikdstock erikdstock changed the title Erik.checkout loading shift fix: Layout shift on load Mar 6, 2026
@erikdstock erikdstock changed the title fix: Layout shift on load fix: Layout shift on checkout load Mar 6, 2026
@relativeci
Copy link

relativeci bot commented Mar 6, 2026

#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  Change 1 change Improvement 1 improvement
                 Current
#7090
     Baseline
#7083
Improvement  Initial JS 2.84MiB(~-0.01%) 2.84MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 19.52% 19.52%
No change  Chunks 110 110
No change  Assets 113 113
No change  Modules 5522 5522
No change  Duplicate Modules 618 618
No change  Duplicate Code 4.93% 4.93%
No change  Packages 250 250
No change  Duplicate Packages 30 30
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#7090
     Baseline
#7083
Regression  JS 8.51MiB (~+0.01%) 8.51MiB
No change  Other 152.75KiB 152.75KiB

Bundle analysis reportBranch erik.checkout-loading-shiftProject dashboard


Generated by RelativeCIDocumentationReport issue

@erikdstock erikdstock force-pushed the erik.checkout-loading-shift branch from 0b5fab9 to cca797e Compare March 6, 2026 20:59
@erikdstock erikdstock marked this pull request as ready for review March 6, 2026 21:31
@erikdstock erikdstock changed the title fix: Layout shift on checkout load fix(EMI-3113): Layout shift on checkout load Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant