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

Re-apply slider shadow padding #1231

Merged
merged 2 commits into from
Jan 21, 2022
Merged

Re-apply slider shadow padding #1231

merged 2 commits into from
Jan 21, 2022

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Jan 19, 2022

Why are these changes introduced?

Refs #1217
Fixes #1157

  • Fixes slider shadow padding on non-product media sliders
  • Adds some additional padding to the same logic for focus outlines

What approach did you take?

Reverted a change from a previous commit that limited the scope of the shadow padding styles.
Also noticed that the blogs slider may have been prevented from receiving the proper shadow offset values.

Other considerations

There are other improvements we can make to this logic, but this commit just aims to get it back to working for all sliders in the theme.

Testing notes:

  • Collection list (tablet/mobile)
  • Featured collection (tablet/mobile)
  • Multicolumn (mobile)
  • Featured blog (tablet/mobile)
  • Product media gallery (mobile)

Demo links

Checklist

Comment on lines 158 to 161
.product-grid,
.collection-list,
.blog__posts,
.card {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can update these to use shared classes in the future.

@kmeleta kmeleta changed the title Re-apply slider shadow padding and fix blog slider Re-apply slider shadow padding Jan 19, 2022
@ludoboludo ludoboludo self-requested a review January 20, 2022 18:30
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

Looks good 👌 Just wondering if we should tweak the calculation a little 🤔

@@ -24,9 +24,6 @@ slider-component {
scroll-padding-left: 1rem;
-webkit-overflow-scrolling: touch;
margin-bottom: 1rem;
}

.slider--mobile.product__media-list {
padding-top: calc(var(--shadow-vertical-offset) * -1 + var(--shadow-blur-radius));
padding-bottom: calc(var(--shadow-vertical-offset) + var(--shadow-blur-radius));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might always need to have a bit of padding top and bottom whatever the vertical offset value is 🤔 maybe using a max(0.5rem, calc(var(--shadow-vertical-offset) * -1 + var(--shadow-blur-radius))) to account for focus styles:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was going to include .5rem here actually but then we may not want an additional .5rem if there's already a shadow offset that will cover it. It also didn't fix it in one case (because the calculation currently relies on negative padding not being a problem), I believe with positive offset shadow applied?. tl;dr I just want sliders to work again and will handle more complicated stuff in follow ups.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Edit: Actually, using max() may straighten that up nicely. Good call. Will update if all looks well 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Donezo

Copy link
Contributor

@martinamarien martinamarien left a comment

Choose a reason for hiding this comment

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

Let me know if you think this should be in a different PR.

padding-top: calc(var(--shadow-vertical-offset) * -1 + var(--shadow-blur-radius));
padding-bottom: calc(var(--shadow-vertical-offset) + var(--shadow-blur-radius));
padding-top: max(0.5rem, calc(var(--shadow-vertical-offset) * -1 + var(--shadow-blur-radius)));
padding-bottom: max(0.5rem, calc(var(--shadow-vertical-offset) + var(--shadow-blur-radius)));
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this isn't technically part of this PR, but this is something I've observed:

For cards that use the standard style, and particularly for the featured collection product cards and collection list collection cards, I think this adds a lot of unintended space below the cards on mobile and tablet. When the slider is enabled and when it's not. The list itself already adds margin-bottom: 1.5rem on tablet, so we probably need to make some exceptions for these types of cards.

I'm wondering if the padding should be applied below the image instead of the slider when the card type is Standard.

Screen Shot 2022-01-20 at 3 08 23 PM

Screen Shot 2022-01-20 at 3 10 56 PM

Screen Shot 2022-01-20 at 3 22 52 PM

In this example, you can see that all padding has been removed from the section, but there's still a lot of space between the cards and the next section.

Screen Shot 2022-01-20 at 3 13 08 PM

This makes sense if the card style is "Card" (see below), but it's causing some unintended spacing for the "Standard" style.

Screen Shot 2022-01-20 at 3 14 55 PM

Places to look at:

  • Featured collection product cards
  • Collection list collection cards
  • Blog post cards

Copy link
Contributor

Choose a reason for hiding this comment

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

good point, so should be conditional to a class applied based on the card/standard layout then

Copy link
Contributor Author

@kmeleta kmeleta Jan 20, 2022

Choose a reason for hiding this comment

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

That's definitely valid and I believe Meli mentioned it in the ticket too (I don't have this PR closing the issue for this reason). If the card discrepancy is also a sev 1 concern that we want done asap I can play with it before merging this. Otherwise, the current fix in this PR is definitely sev 1 and should be merged separately so it doesn't potentially get held up by reviews/discussions for the card aspect. cc @melissaperreault

Copy link
Contributor

Choose a reason for hiding this comment

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

Aligned to tackle separately!

@ludoboludo
Copy link
Contributor

ludoboludo commented Jan 20, 2022

It fixes this too: #1157 if we add the max(... for focus style.

@kmeleta
Copy link
Contributor Author

kmeleta commented Jan 20, 2022

It fixes this too: #1157 if we add the max(... for focus style.

Thanks Ludo I'll add it to the PR description

@kmeleta kmeleta merged commit 1ddf30e into main Jan 21, 2022
@kmeleta kmeleta deleted the reapply-slider-padding branch January 21, 2022 15:18
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Re-apply slider shadow padding and fix blog slider

* Account for focus outline
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.

Focus outline on slider items is cut out at the top and bottom
4 participants