Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the shopping cart skeleton. #98867

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

StevenDufresne
Copy link
Contributor

@StevenDufresne StevenDufresne commented Jan 24, 2025

Fix: #98526

This PR attempts to align the shopping cart skeleton more closely with the final state to reduce visual shift on load. There isn't a perfect state for the skeleton since the number and type of products change the cart's layout.

I've focused on making the top section of the left side align on load. Specifically the title, the site name, the first product title, and the price. Having those align, in my opinion, significantly reduces shift.

Screenshots

Before

Screen.Capture.on.2025-01-24.at.10-16-22.mp4

After

Screen.Capture.on.2025-01-24.at.09-46-11.mp4
Screen.Capture.on.2025-01-24.at.09-43-25.mp4

Stills

Before After Final
calypso localhost_3000_checkout_abstracting blog (7) calypso localhost_3000_checkout_abstracting blog (2) calypso localhost_3000_checkout_abstracting blog (3)
calypso localhost_3000_checkout_abstracting blog (10) calypso localhost_3000_checkout_abstracting blog (5) calypso localhost_3000_checkout_abstracting blog (4)

RTL

Before After Final
calypso localhost_3000_checkout_abstracting blog (8) calypso localhost_3000_checkout_abstracting blog (9) calypso localhost_3000_checkout_abstracting blog (1)

Why are these changes being made?

It's not that the current skeleton is bad, it isn't, but I believe that reducing any extra cognitive load in shopping carts is a worthwhile pursuit. They communicate a lot about a product.

Pinging design for feedback:
@Automattic/dotcom-design

Testing Instructions

  • Add different types of items to your cart
  • Navigate to your cart
  • Verify the skeleton matches the cart later.

Test RTL

Repeat the same test with your account set to a RTL language like Arabic.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@StevenDufresne StevenDufresne added the [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR label Jan 24, 2025
@github-actions github-actions bot added the [Status] Design Input Requested Label automatically added to PRs where design feedback is requested label Jan 24, 2025
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~139 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
checkout                           +430 B  (+0.0%)     +139 B  (+0.0%)
site-purchases                     +175 B  (+0.0%)      +57 B  (+0.0%)
purchases                          +175 B  (+0.0%)      +57 B  (+0.0%)
jetpack-cloud-partner-portal       +175 B  (+0.0%)      +57 B  (+0.0%)
a8c-for-agencies-purchases         +175 B  (+0.0%)      +57 B  (+0.0%)
a8c-for-agencies-client            +175 B  (+0.0%)      +57 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~139 bytes added 📈 [gzipped])

name                                             parsed_size           gzip_size
async-load-calypso-my-sites-checkout-modal            +430 B  (+0.0%)     +139 B  (+0.0%)
async-load-calypso-blocks-editor-checkout-modal       +430 B  (+0.0%)     +139 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@StevenDufresne StevenDufresne requested a review from a team January 24, 2025 01:33
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 24, 2025
@StevenDufresne StevenDufresne marked this pull request as ready for review January 24, 2025 02:05
@StevenDufresne StevenDufresne requested a review from a team as a code owner January 24, 2025 02:05
@StevenDufresne StevenDufresne changed the title Update the skeleton. Update the shopping cart skeleton. Jan 24, 2025
@crisbusquets
Copy link
Contributor

cc @fcoveram, as he was adjusting the checkout design 👀

Copy link
Member

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

Outstanding. This feels a substantial improvement as far as preventing layout shifts. Works well:

upgrades

I also tested zooming in on the page while the skeleton was blinking, just to see if anything would be off as part of that, but that doesn't seem the case.

Looking at the code, it also looks overall improved. And finally, this doesn't appear to affect negatively any future efforts in this same space.


Happy to give it a ✅, though I saw some other issues as I was testing this. I'm 95% sure it's unrelated, but just to be sure, let me know and I can re-test and open separate issues if need be. First is this:

issue

The cart dropdown opens far removed from the button.

Secondly, I saw an overflow issue as things were loading:

overflow issue

overflow issue

To be fair, that's all sections, and only when loading fresh from cache, and mostly in small browser windows. It may be my curious browser choice (Vivaldi, Chromium based), or it may hint at an overflow issue.

Can you repo any of those?

@sirbrillig
Copy link
Member

sirbrillig commented Jan 24, 2025

The cart dropdown opens far removed from the button.

Ugh. Thanks for noticing! I've created a bug report for this here. I'll try to track down what changed.

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

This looks good to me! Thank you for updating this. I'm not sure if it's changed much since the original checkout rebuild in 2020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Design Input Requested Label automatically added to PRs where design feedback is requested [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Update the cart's loading skeleton to be more accurate to prevent a big frameshift
5 participants