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

[Image with text] Fix ambient movement and zoom in on placeholder #2744

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

ludoboludo
Copy link
Contributor

PR Summary:

Fixes the ambient background animation on the placeholder image

Why are these changes introduced?

Fixes #2742

What approach did you take?

Changed the left, top and transform values when the ambient and zoom in animation is enabled.

Other considerations

Visual impact on existing themes

Testing steps/scenarios

  • Add an image with text section
  • Set the image behaviour to be ambient or zoomed in and confirm it's working as expected (the position of the SVG is looking good)

Demo links

Checklist

@kimberlyoleiro
Copy link

Looks good to me https://hllvkum3xlhy2x07-45840990230.shopifypreview.com

@lougoncharenko lougoncharenko self-requested a review June 28, 2023 14:26
@@ -74,7 +74,7 @@
fill: currentColor;
}

.image-with-text__media--placeholder.animate--ambient > svg {
.image-with-text__media--placeholder:is(.animate--ambient, .animate--zoom-in) > svg {
top: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Asking question so I can enhance my learning: why did you use :is() vs. :where() ?

Copy link
Contributor Author

@ludoboludo ludoboludo Jun 28, 2023

Choose a reason for hiding this comment

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

The main difference is in specificity.

:is() will use the selectors within it to count towards the specificity of the overall selector.
:where() will default to a specificity of 0.

So in our case, because the selector used to be .class.anotherClass then it would have a specificity count of 2. By using :is() I make sure I keep that same specificity.

If I had used :where() then the specificity would be lower.

Here is a specificity calculator and its result:

Calculator

Here is a useful breakdown 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wow! This is a very helpful diagram! Thank you so much for taking the time to explain the difference to me !

Copy link
Contributor

@lougoncharenko lougoncharenko left a comment

Choose a reason for hiding this comment

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

This PR is working as expected in the editor and preview!
Here's all that I tested for this PR

  • Tested in mobile, tablet and desktop view
  • Tested in safari and chrome
  • Applied color scheme on all of the images with text variations (placeholder w/ ambient, placeholder w/zoom, image w/ambient, image with zoom, and no animation)
  • Tests changing typography in global theme settings
  • Tested changing button styles in global theme settings
  • Tested media global theme settings by applying border, paddings and shadows

Copy link
Contributor

@eugenekasimov eugenekasimov left a comment

Choose a reason for hiding this comment

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

👍

.image-with-text__media--placeholder:is(.animate--ambient, .animate--zoom-in) > svg {
top: 0;
left: 0;
transform: translate(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you find you needed to set the initial translate to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed specifically for the zoom in effect and doesn't do any harm for the ambient basically 👍

@ludoboludo ludoboludo merged commit dd8436d into main Jul 6, 2023
@ludoboludo ludoboludo deleted the image-with-text-ambient-placeholder-fix branch July 6, 2023 19:06
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
…opify#2744)

* Fix ambient movement on placeholder

* fix position for zoom-in animation too
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.

Image with Text - Ambient Movement Animation Broken
5 participants