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

animate Featured collection, Related products and Product grid sections #2372

Merged
merged 10 commits into from
Mar 30, 2023

Conversation

metamoni
Copy link
Contributor

@metamoni metamoni commented Mar 8, 2023

PR Summary:

Makes Featured collection, Related products and Product grid fade in on scroll.

Why are these changes introduced?

Fixes #2318

Decision log

# Decision Alternatives Rationale Downsides
1 Use the --animation-order and animation-delay properties to create cascading animation Use nth-child approach from prototype Achieves the same thing in fewer lines of code, making it more readable. We're only setting a CSS attribute on each element in our script, in an already existing loop, so performance impact should be minimal Relying on JS rather than CSS. However, we're not introducing a lot of new logic, we're only setting a new attribute
2 Don't apply cascading animations to desktop and mobile carousels Only cascade visible product cards in a carousel and stop cascading items that come into view when navigating left-right in the carousel Achieving the alternative effect is very complicated, due to the many available permutations (variable number of columns on desktop and mobile) No cascading effect in carousels

Visual impact on existing themes

Once this PR is merged, the Featured collection, Related products and Product grid sections will scroll into view if the Reveal on scroll setting is enabled in Theme Settings > Animations.

Featured collection

featured.collection.scroll.into.view.mp4

Product grid

product.grid.mp4

Related products

related-products.mp4

Testing steps/scenarios

Featured collection - Default product grid view (title and description slide in, products cascade in)

  • Go to the theme editor
  • Add an empty featured collection and verify that the title scrolls into view
  • Verify that the empty collection items cascade into view
  • Add a description and verify that it scrolls into view with the title
  • Add a collection and verify that each item cascades into view
  • Change the number of columns/products and verify that the section still animates correctly
  • Enable the quick add button and verify that it slides in
  • Check with different settings (see more detailed steps for carousel below)

Featured collection - Desktop and mobile carousel (title, description and container slide in, products do not cascade in)

  • Enable carousel on desktop. The section should slide in but individual products should not cascade in
  • Change different settings and verify that it still animates as expected
  • While still in Desktop view, tick Enable swipe on mobile and verify that it still animates as expected
  • Test with different mobile column settings
  • Switch to Mobile view and test both the cascading grid and carousel versions
  • While still in Mobile view, turn desktop carousel on/off and test that everything animates as expected on mobile

Product grid and related items

  • Click "Shop all" to bring up the Product grid collection and verify that it animates as expected
  • Change different settings and verify that the section still animates correctly
  • Navigate to the product page and scroll to the bottom to reveal the Related products section. Verify that it animates as expected
  • Change different settings and verify that the section still animates correctly
  • Turn on Reduce motion in your OS and verify that the animations stop working

Demo links

Checklist

@metamoni metamoni self-assigned this Mar 8, 2023
@metamoni metamoni force-pushed the animate-featured-collection branch from f6f0f4b to 6ee24e0 Compare March 8, 2023 15:14
@metamoni metamoni changed the title wip animate Featured collection, Related products and Product grid sections Mar 8, 2023
@metamoni metamoni force-pushed the animate-image-banner branch from 36d0d9e to 108dc5b Compare March 9, 2023 09:25
@metamoni metamoni requested a review from kjellr March 9, 2023 14:29
@metamoni metamoni force-pushed the animate-featured-collection branch from bf50ae9 to 815055b Compare March 9, 2023 14:32
@LucasLacerdaUX LucasLacerdaUX self-requested a review March 9, 2023 15:19
@kjellr
Copy link
Contributor

kjellr commented Mar 9, 2023

This works really well, and the JS solution feels way more elegant than all the nth-child rules in previous iterations. I doubt we're really sacrificing much in terms of performance by it either. Nice work! 👏

Just noting that @metamoni and I chatted earlier and determined that it's ok for V1 to just fade/slide-in the entire Related Products section at once (rather than in a cascade, like other product grids). During initial prototypes, there were some issues around getting this section to animate correctly.

I'm seeing some related bugginess here — if you scroll too quickly into the Related Products section, you get a little jump before the related products appear. Here's a slow-motion video to demonstrate. This isn't related to our work here, but it's a little more obvious because all the other animations are incredibly smooth. 😅

If we think there's an easy fix for this, let's do it! Otherwise we can look into it later and I don't consider it a blocker.

@metamoni metamoni force-pushed the animate-image-banner branch from 229e09d to 502064e Compare March 10, 2023 08:10
@metamoni metamoni force-pushed the animate-featured-collection branch from 815055b to 0a2fb26 Compare March 10, 2023 08:13
@metamoni metamoni requested a review from stufreen March 10, 2023 08:14
@metamoni metamoni marked this pull request as ready for review March 10, 2023 08:14
@metamoni metamoni marked this pull request as draft March 10, 2023 08:38
@metamoni metamoni force-pushed the animate-featured-collection branch 2 times, most recently from 7bc7879 to 4637192 Compare March 10, 2023 09:49
@metamoni metamoni force-pushed the animate-image-banner branch 2 times, most recently from 3456e44 to c7dc625 Compare March 13, 2023 15:42
Base automatically changed from animate-image-banner to reveal-on-scroll-animations March 13, 2023 16:14
@metamoni metamoni force-pushed the animate-featured-collection branch from 4637192 to 0489839 Compare March 14, 2023 14:44
@metamoni metamoni force-pushed the reveal-on-scroll-animations branch from 52edc83 to 0e01a72 Compare March 15, 2023 07:25
@metamoni metamoni force-pushed the animate-featured-collection branch 2 times, most recently from 5d2744e to 2949e34 Compare March 15, 2023 13:49
@metamoni metamoni marked this pull request as ready for review March 15, 2023 13:54
@metamoni metamoni force-pushed the animate-featured-collection branch from 3c5b4ca to 32a3758 Compare March 15, 2023 14:28
kjellr
kjellr previously approved these changes Mar 15, 2023
Copy link
Contributor

@kjellr kjellr left a comment

Choose a reason for hiding this comment

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

This is working nicely for me — haven't stumbled upon any broken parts. 👍

stufreen
stufreen previously approved these changes Mar 29, 2023
kjellr
kjellr previously approved these changes Mar 30, 2023
Copy link
Contributor

@kjellr kjellr left a comment

Choose a reason for hiding this comment

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

One very minor comment, but this looks good to me! 🎉

@metamoni metamoni dismissed stale reviews from kjellr and stufreen via 4235ec7 March 30, 2023 13:41
@metamoni metamoni requested review from stufreen and kjellr March 30, 2023 13:42
@metamoni metamoni force-pushed the animate-featured-collection branch from 4235ec7 to 298c35f Compare March 30, 2023 13:44
@metamoni metamoni merged commit 30560f0 into main Mar 30, 2023
@metamoni metamoni deleted the animate-featured-collection branch March 30, 2023 15:23
@metamoni metamoni mentioned this pull request Mar 31, 2023
12 tasks
pangloss added a commit to pangloss/dawn that referenced this pull request Apr 1, 2023
* shopify/main:
  Fix empty space in the drawer when there are no social media icons / account / localizations (Shopify#2425)
  Update 1 translation file (Shopify#2479)
  animate Featured collection, Related products and Product grid sections (Shopify#2372)
  Update 1 translation file (Shopify#2474)
  Update 1 translation file (Shopify#2473)
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
…ns (Shopify#2372)

animate Featured Collection, Product grid, Related products
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Featured collection]: Add cascading fade in on scroll animation
5 participants