-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Product Media Layout updates #937
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.
Looks really good. Found the code nice to read as well 👌
Tested quite a few scenarios and left a few notes on what I noticed.
assets/global.js
Outdated
onButtonClick(event) { | ||
event.preventDefault(); | ||
const slideScrollPosition = event.currentTarget.name === 'next' ? this.slider.scrollLeft + this.sliderLastItem.clientWidth : this.slider.scrollLeft - this.sliderLastItem.clientWidth; | ||
const step = event.currentTarget.dataset.step || 1; | ||
const slideScrollPosition = event.currentTarget.name === 'next' ? this.slider.scrollLeft + (step * this.sliderLastItem.clientWidth) : this.slider.scrollLeft - (step * this.sliderLastItem.clientWidth); |
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 is a bit of a delay happening sometimes between the thumbnail sliding to the currently active image: video
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 have no idea how to fix this without a big refactor on the slider component.
I don't think it should be a blocker, though. Would it be okay to solve this on follow up PRs?
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! not a blocker at all 👍
Initial Desktop first-pass observations:
|
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.
After a quick pass on the code, this is looking really great. I only have one comment so far, plus the vid I sent you on Slack. Great catches by Ludo as well. 👍
snippets/product-thumbnail.liquid
Outdated
srcset="{% if media.preview_image.width >= 288 %}{{ media.preview_image | img_url: '288x' }} 288w,{% endif %} | ||
{% if media.preview_image.width >= 576 %}{{ media.preview_image | img_url: '576x' }} 576w,{% endif %} | ||
{% if media.preview_image.width >= 750 %}{{ media.preview_image | img_url: '750x' }} 750w,{% endif %} | ||
{% if media.preview_image.width >= 1100 %}{{ media.preview_image | img_url: '1100x' }} 1100w,{% endif %} | ||
{% if media.preview_image.width >= 1500 %}{{ media.preview_image | img_url: '1500x' }} 1500w,{% endif %} | ||
{{ media.preview_image | img_url: 'master' }} {{ media.preview_image.width }}w" | ||
src="{{ media | img_url: '1500x' }}" |
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 will need to be a multiplier on the values in the gallery for optimal desktop image sizes dependent on the width of the gallery. Ping me if you want details, but for example... if the original width of the container was 50%
and an image size for that is 1000
, and the setting is now 60%
, the image needs to be 1200
when that setting is selected.
I think it will take some assign
s, unfortuantely.
After adding I'd like to propose including hint text onto each <button
class="thumbnail thumbnail--narrow"
aria-label="{btn.label}"
aria-controls="GalleryViewer-template--15085127434262__main"
aria-describedby="thumbnail-{i}"
>
<img
id="thumbnail-{i}"
src="{img.src}}"
alt="{img.alt}"
height="200"
width="200"
…
/>
</button> With this screen readers will announce:
|
In addition to the desktop review, here's some notes on the mobile experience:
|
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.
Hi @LucasLacerdaUX I've been working with @duygukalaycioglu to make some content updates. They're reflected in the Figma file + listed below. Let me know if you need more info, and D let me know if there's anything I've missed!
|
@katycobb @duygukalaycioglu I have a question about:
Does that mean we are changing Even if we are updating that setting's default, the closest option to the default mobile experience is actually |
@LucasLacerdaUX oof, good question. @duygukalaycioglu let's chat about this! |
@LucasLacerdaUX I connected with @duygukalaycioglu: we'll update the help text to No change to the mobile thumbnail default needed! |
@katycobb Not sure if I understand? The help text looks the same as before? 👀 |
I pushed a few updates to the branch. I've addressed most of the comments from reviewers, except for the thumbnail sizing logic (will look into that tomorrow) and some minor bugs. Hopefully this will be fully ready for new reviews tomorrow morning. The new demo links are: Accessibility updatescc @svinkle Fixed
Not addressed
Unfortunately, this seems to be caused by YouTube's video player. I couldn't find a way to prevent this autofocus. Will keep looking for a solution.
Hmm. When you say If we are considering visually hiding the invisible elements like we do on desktop, can you add more on the rationale behind this so we can discuss this with designers? This would limit the current UX as it would no longer allow mobile users to navigate through the media via swipe gestures. New decisions
|
Confirmed. New issue being this text can be found when navigating via virtual cursor. If you can set a timeout to clear
Confirmed.
Confirmed on desktop and mobile for the thumbnail view. Although, now that I'm aware of the swipe feature on mobile (see note below) I'd say this would apply to desktop only. Is this possible?
Confirmed.
Confirmed, though image type seems to start at
Confirmed. New issue being the focus ring is placed below and to the left of the larger image in the gallery viewer. Seems to be images only. Please review.
Thanks for looking into this. It seems to be true for hosted, non YouTube video as well.
Ah, no worries. I didn't realize the swipe feature existed. With this context in mind, ignore my original comment. |
Hi @LucasLacerdaUX: Melissa, D and I connected and aligned on the behavior of this section and have made some content updates we think will better describe the settings. Let me know if this makes sense given your feedback and knowledge of the section!
cc: @duygukalaycioglu and @melissaperreault |
Demo links
I've followed the
Updated. It now checks if the component is using a non
Fixed! It now starts at 1 for every media type.
Is this issue restricted to when we are using VoiceOver / another assistive technology? Or does it also happen with the browser's regular focus ring? This is what the (browser's) keyboard focus ring looks like for me: However, VoiceOver definitely shows an additional ring around the button element: This duplicated focus ring also happens on the product card, which I based this solution on. However, in that case, we have the product title inside the full-size link (the one with that uses the Do you have any ideas on how I could solve this for product images without breaking High Contrast Mode? If I set the button to wrap the entire image, we'll end up with the same issue we originally had before applying the
Oh, you're right! That's why I was unable to get it fixed for YouTube 🤦 We had a Fixed. The focus now remains on the thumbnail regardless of the media type you select. @katycobb Thanks for the update! Looks perfect to me now! Demo links |
Confirmed. 👍
Looks good.
Seems to be Safari only, when using Tab.
Confirmed. |
a3349c4
to
23b1e24
Compare
18d5eee
to
56a370e
Compare
PR is ready for final reviews. Thumbnails / image |
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 great!!
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 very nice 👌
Left a few comments of things I noticed. Nothing major though 🤔
"label": "t:sections.main-product.settings.gallery_layout.options__2.label" | ||
}, | ||
{ | ||
"value": "thumbnail_slider", |
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.
Good question! I think it is self explanatory but a good candidate for help doc precisions.
.product--thumbnail .product__media-gallery, | ||
.product--thumbnail_slider .product__media-gallery, | ||
.product--stacked .product__info-container--sticky { | ||
display: block; | ||
position: sticky; |
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.
One thing I notice here with position sticky on the media gallery is that it makes it a bit annoying to get to see the video: video
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.
Hum, this is interesting. A few things come to mind:
- This is not only impacting videos but any media in a landscape ratio
- This is not something that was concerning with the stacked layout because we had more vertical visuals to view
- Since merchants can deactivate the
Enable sticky header
setting and the other one, I am not too concerned. That behaviour is not meant for all instances and this is the reason why the settings exist. - Our defaults set merchants for success if they remain with the
Stacked
layout.
@ludoboludo and @tyleralsbury Image sizes have been updated for both main media, deferred-media posters and thumbnails :) I've also addressed all of Ludo's comments about code. This should be ready for a final review. |
sections/main-product.liquid
Outdated
} | ||
|
||
removeListSemantic() { | ||
this.elements.viewer.slider.setAttribute('role', 'presentation'); |
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 do sometimes get an error in the console but I think it only happens in the theme editor before you hit Save
: screenshot
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.
Noted maybe one thing that could be changed in the PR. The vertical alignment of the thumbnail slider buttons. Otherwise didn't notice any other issues.
} | ||
if (!this.elements.thumbnails || this.dataset.desktopLayout === 'stacked') { | ||
activeMedia.scrollIntoView({behavior: 'smooth'}); | ||
} |
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 kinda feel like it's nice to have it scroll back to the top of the media being opened. But I guess it's weird to keep focus on the thumbnail button and potentially have it outside of the viewport 🤔
This can be a follow up conversation anyway. Not a blocker and quick fix if needed.
video
ccing @melissaperreault for future conversation on this.
if (!customElements.get('media-gallery')) { | ||
customElements.define('media-gallery', class MediaGallery extends HTMLElement { |
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 is clever. Using this approach we might even be able to inline some of our smaller custom elements. Keeping this one in the back of my mind for asset management ideas.
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.
Looks good - I gave it some tests and looked again at the code. 🚢
Why are these changes introduced?
Adds three new settings to product page:
Closes #828.
What approach did you take?
gallery
andthumbnails
) and keeps them in sync. It also serves as an interface for other components, likeVariantSwitch
. Instead of changing the DOM directly, we now make this request via asetActiveMedia(media, prepend)
function.<slider-component>
. This is different to the dots/numbers in theSlideshow
component that @ludoboludo implemented on Slideshow section #840, because both thumbnails and viewer can be controlled separately. The same HTML is used for both Mobile and Desktop.Setting 1: Large screens layout
Setting 2: Media size
Thumbnails
layout is set.Thumbnails
layout is set.Thumbnails
layout is set.Setting 3: Mobile thumbnails
< 1/3 >
format for slider.next/prev
button will scroll 3 slides at a time. If user scrolls the main gallery slider, the thumbnail slider will be kept in sync.Accessibility:
button
) have aaria-controls="GalleryViewer-{{ section.id }}"
and are labelled (viaaria-label
) depending on the media type:Load image {{ index }} in gallery view
Load 3D Model {{ index }} in gallery view
Play video {{ index }} in gallery view
<h2>Gallery Viewer</h2>
at the top.role="status"
div will receiveImage {{ index }} is now available in gallery view
once the<img>
is loaded for the first time.Demo links
Checklist