-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 slider shadow padding implementation #1292
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, left a few comments.
} | ||
|
||
.slider.slider--mobile.contains-card--standard .slider__slide:not(.collection-list__item--no-media) { | ||
padding-bottom: var(--focus-outline-padding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mention in the PR desc that it's something we can consider, but could also be solved by allowing spacing settings for card titles or something. I don't really like the idea of handling this the same way. I feel the gap between image and title could end up being unnecessarily far apart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If UX likes the idea of just using the same automatic padding here, I'll add it, but if it's something to be discussed more, it should be handled separately. cc @melissaperreault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since merchants have the ability to set the opacity to maintain good contrast, I would handle separately please because we need to explore, define and observe how this is being used. We'll consider how it affects section headings as well when the vertical offset is negative for both desktop and mobile.
There might be more opportunity to scale systematically dependent of the shadow opacity, offset, and blur for instance or potentially add new settings.
assets/base.css
Outdated
.contains-card--standard, | ||
.contains-card--card, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you only have modifiers atm, I would suggest applying those variables to .contains-card
and add that class where you've added .contains-card--style
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth so much on these. I ultimately didn't add it because it wouldn't be useful, as used currently. But it theoretically makes sense. I may opt to just wait til we're making more use of these contexts (grid gap changes and make sure I'm still going to need them the way I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could have .contains-card
and .contains-card--standard
🤔 I think it'd be nice to follow BEM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's worth the unused additional class in the dom, but I've added it to be more correct 2af6578
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh what I meant is maybe contains-card
could be the default using the current styles from contains-card--card
. And then only have one "modifier" with --standard
. What do you think 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I think I like that actually. Does this make sense? d7f333e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think so 👍
} | ||
|
||
.slider.slider--mobile .slider__slide { | ||
margin-bottom: 0; | ||
padding-bottom: 0; | ||
padding-top: max(var(--focus-outline-padding), var(--shadow-padding-top)); | ||
padding-bottom: max(var(--focus-outline-padding), var(--shadow-padding-bottom)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or let people use the section padding setting to deal with it 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my initial thought was using section padding. In a perfect world where the section shadow/z-index thing is fixed, that doesn't even get cut off by the section below it. This PR is only needed because of the overflow: hidden on sliders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious to learn the settings combination as I wasn't able to get it on Collection cards, but mainly on Multicolumn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's kind of interesting Meli that not all sections do that. There may be a discrepancy between the isolate implementations in those sections. In any case, it appears it's an adjacent section cutting the shadow off, not an overflow: hidden from sliders. So I'd probably rather address the actual problem rather than use the magic padding here as a bandaid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed a change for that. I don't want to go down a rabbit hole in this PR, but if that looks better you, we'll roll with it. Otherwise I'll revert and address separately. I think there's a issue open for avoiding the isolate scenario altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to drop the issue referenced above about potentially fixing this by removing the isolate approach here for reference #1241
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Ken!
Replied where needed and approving this PR as it is currently fixing the issue described. I would solve any follow up items in another PR/issue. Happy to pair and align on what needs alignment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me. I'm wondering if there would be any value in turning the calculation into a reusable class with a name that tells us what it's there for - it's a bit complex to get your head around unless you've got the context.
No need at this precise moment, but something to consider as part of the refactoring we're looking to do.
Thanks @tyleralsbury I did try to break it up a bit into vars with somewhat descriptive labels like |
It's probably okay as-is if it's only used for sliders. My concern would be this calculation popping up in different places throughout the theme, making it harder to maintain. If this isn't something we need to worry about, then I think the named variable is good enough. |
* Update slider shadow padding implementation * Adjust blog isolate * bem * bem adjust
Why are these changes introduced?
Fixes #1217
We previously added additional padding above and below sliders to compensate for shadow offset. This change makes it possible to remove the additional bottom padding specifically for sliders that contain standard style cards.
What approach did you take?
Previously, slider shadow padding was applied to the
<ul class="slider">
element. I've changed the approach to put this padding on the<li class="slider__slide">
elements instead. This was mostly to accommodate a case in collection list where empty collection cards still need the bottom padding regardless of which card style is used (see here)In order to better scope generic shadow variables and account for exception cases I've created new classes to describe the type of children a slider/grid contains. I think these could be utilized more to further simplify global setting variable inheritance, but for now I'm using only where relevant to this issue.
Using the same method, I also added an exception that prevents the previously added .5rem for focus outlines on content-container sliders, which don't receive focus.
Other considerations
Probably a UX decision, but instead of just removing bottom padding we could add it between the card image and the title. I don't think the further separation of these two elements looks particularly good, but maybe for preserving contrast we should consider it. Perhaps this is better solved by providing a title spacing setting or something.
Struggled naming the new contains classes. Other ideas welcome.
This PR doesn't modify the actual shadow offset/blur calculations we're using for the padding. We can probably still do more to improve this but should be considered separately from this PR.
Testing notes:
Demo links
Checklist