Repository navigation
Add a blocked event when the checkout window is blocked - #835
Conversation
Bundle Size Budgets
Bundle and package sizeWeb bundle sizes cover shipped runtime JavaScript. Package sizes cover the full published archive, including any source maps, declarations, and documentation it contains.
Web package files (uncompressed)These are uncompressed file sizes; they do not sum to the compressed package size above.
How sizes are measuredMeasured from the PR base SHA and PR head SHA. Web bundle rows sum shipped |
684898d to
b83b70d
Compare
| }, | ||
| } as CSSStyleDeclaration); | ||
| const blockedEventSpy = vi.fn(); | ||
| checkout.addEventListener("blocked", blockedEventSpy); |
There was a problem hiding this comment.
Should we add one test with document.addEventListener() as we've set bubbles: true
There was a problem hiding this comment.
Good point! I'll add that in
3219829 to
f4f93f4
Compare
f4f93f4 to
643a806
Compare
8905b5c to
f289ade
Compare
f289ade to
82205ed
Compare
82205ed to
924b591
Compare
What changes are you making?
Stacked on #791. Retarget to
mainonce it merges.When the browser blocks the checkout window, the component now dispatches a
blockedevent. With #791 alone, stores that hide the overlay get no signal at all, and no store can track how often checkout is blocked.blockedfires on every blocked attempt, including retries, whether or not the overlay is shown. It bubbles and has no detail, likeclose.open()directly from ablockedlistener is ignored with a warning. Without that guard, the call is blocked again and recurses until the browser throws "Maximum call stack size exceeded".ShopifyCheckoutBlockedEventand ablockedentry inShopifyCheckoutEventMap. The README events table and the sample app's event log include it.How to test
dev web testanddev web lint. New tests coverblockedwith the overlay shown and hidden, and the ignoredopen()call from a listener.pnpm sample): under Flow, choose Use existing checkout source and paste a cart permalink. Runwindow.open = () => nullin the DevTools console, then click Open checkout:blockedappears in the Events panel. Reload to undo.document.head.append(Object.assign(document.createElement('style'), { textContent: 'shopify-checkout::part(overlay) { display: none; }' }))before clicking Open checkout. No overlay appears, andblockedstill fires.Before you merge
Important
platforms/web/README.md)