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

Slideshow section #840

Merged
merged 95 commits into from
Dec 14, 2021
Merged

Slideshow section #840

merged 95 commits into from
Dec 14, 2021

Conversation

ludoboludo
Copy link
Contributor

@ludoboludo ludoboludo commented Nov 1, 2021

Why are these changes introduced?

Fixes #833

What approach did you take?

I reused quite a bit of the styling for the image banner as if you have only one slide the look is very similar. Section settings are also very similar so it seemed to make sense.

I create a new JS class that extends the functionality of the existing SliderComponent.

Other considerations

  • I added an accessibility setting for merchants to give a TLDR about the purpose of the slideshow
  • Navigation button size. On mobile they're not set to be 44x44 but I think they probably should. But it would have an impact on the design: screenshot (play button isn't active on this example).
  • Grid peek style isn't added at the moment. I thought I would add it as a follow up.
  • Tab order on mobile isn't great if we display the controls in between the text image and text box. Though it could be re arranged in the structure, I would have to duplicate some styling as the pattern so far has been to have it after the slider.

Issue: when editing blocks/slides it won't show you the current slide you're editing in the theme editor.

Potential benefits to add:

  • The slideshow is currently using the image-banner.css file as they share quite a bit of styling. But the code in common could be put into its own file as around 40% of the image-banner.css isn't necessary to the slideshow.
  • Look into using content-visibility. How does it behave if used in browser that don't support the property ? Remove lazy loading of the first slide to load faster when it's the first section and rely on content-visibility to delay the loading when it isn't.

Demo links

Checklist

@ludoboludo ludoboludo marked this pull request as ready for review November 10, 2021 20:11
assets/global.js Outdated Show resolved Hide resolved
locales/en.default.json Outdated Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Outdated Show resolved Hide resolved
sections/slideshow.liquid Show resolved Hide resolved
@svinkle
Copy link
Member

svinkle commented Nov 11, 2021

@ludoboludo Looking good. I left a few notes for an initial review.

Should clicking the number or dots from the slideshow navigation set the focus on the slide ?

No, since they're button controls which imply focus remains on the control. The aria-live announces the newly revealed content.

I added an accessibility setting for merchants to give a TLDR about the purpose of the slideshow

Consider switching to "Slideshow description"

Navigation button size. On mobile they're not set to be 44x44 but I think they probably should.

I agree the bullet and number control sizing could be increased. I doesn't need to be the 44 by 44 but at least maximize the space available via padding.

@svinkle
Copy link
Member

svinkle commented Nov 11, 2021

@ludoboludo I think after you make these adjustments, I'll setup a few sessions with Fable to get user feedback. I'll report back with any new notes. If you need to merge before I get this feedback, go for it. Just be ready to jump back in if I get high severity issues reported back.

@melissaperreault
Copy link
Contributor

melissaperreault commented Nov 12, 2021

Thank you so much Ludo! Great work!

Made a first pass, will do another round later!

UX Update on the remaining points I needed to get back to you + some feedback:

  • Set the maximum of slide to 5
  • I thought we could navigate the slides with left and right keyboard arrows, is this still possible? We did it on Debut.
  • I wonder if the pause on hover should happen after a few seconds instead of instant? That could leave some time to users to just experience the merchant's first intention. Thoughts? cc. @danielvan
  • Border opacity around the controls should be solid rgba(var(--color-foreground),.08); instead of solid rgba(var(--color-foreground),.2); unless there are other evident areas that we use this 20% opacity 🤔
  • We need to pair for the position of the play/pause to test other options quickly, it definitely gets lost to the opposite left. I also want to improve the thickness of the pause strokes.
  • We won't include a small heading font size, I can see the purpose for Rich text but less on this type of section that needs to stand out.

Slider visual controls

  • I believe we are missing some hover states on the numbers, they could increase in opacity and receive the underline once clicked or in focus/view? I took a look at the pagination current implementation and it might not be clear actually.
  • The cursor on the inactive arrow doesn't change and convey the arrow is clickable. I suspect we would need to fix it for the product template nav too.

Content

  • I am wondering if Counter and Numbers are clear for merchants?

Answers to your questions/considerations

Should clicking the number or dots from the slideshow navigation set the focus on the slide ?

No, since they're button controls which imply focus remains on the control. The aria-live announces the newly revealed content.

Navigation button size. On mobile they're not set to be 44x44 but I think they probably should.

I agree the bullet and number control sizing could be increased. I doesn't need to be the 44 by 44 but at least maximize the space available via padding.

I am not sure I understand well the expectations for the focus on the slide. Buyers can click/tap dots or number stepper but it is not the primary way to navigate the slides. The arrows are the main controls. Those main control should have the 44px safe tap target, but not the secondary pagination. They give us a hint of where we are mainly but could be navigated to get to a specific slide.

Remaining things that I need to review

  • All the settings combinations
  • No JS
  • Mobile experience
  • Start requesting help doc update

locales/en.default.schema.json Outdated Show resolved Hide resolved
locales/en.default.schema.json Outdated Show resolved Hide resolved
"label": "Grid"
},
"options__3": {
"label": "Grid and peek"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"label": "Grid and peek"
"label": "Grid with a peek"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 if I do this layout in a follow up PR I might remove it from the settings for now 🤔

locales/en.default.schema.json Outdated Show resolved Hide resolved
@svinkle
Copy link
Member

svinkle commented Nov 12, 2021

@ludoboludo The toggle of the play/pause control on hover/focus is not required. I understand the purpose but as a user navigates through the content the flipping of the icon is very distracting. The end result may be a disoriented user on whether the slideshow is/was paused or playing.

Demo

Dawn slideshow. Keyboard focus moves through the slide content. While doing so, the play/pause control toggles state.

sections/slideshow.liquid Outdated Show resolved Hide resolved
Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX left a comment

Choose a reason for hiding this comment

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

Just some quick comments. I haven't started my review yet but just caught these by looking at the code.

assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated Show resolved Hide resolved
@danielvan
Copy link
Contributor

danielvan commented Nov 12, 2021

I wonder if the pause on hover should happen after a few seconds instead of instant? That could leave some time to users to just experience the merchant's first intention. Thoughts? cc. @danielvan

I think the user intent on hover is to look at the slide, so I would pause immediately on hover, and play again once the mouse is out. For accessibility, I think it is also better to pause immediately – @svinkle can you let me know if this is true?

Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX left a comment

Choose a reason for hiding this comment

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

Just dumping some initial ideas and questions before the weekend.

Also: you did an amazing work putting up together such a complex section. Thanks again for that . There's still a lot of functionality to test on my end, but from my quick look at the Theme Editor I love what I'm seeing! :)

I'll come back on Monday to finish my review.

assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated
Comment on lines 570 to 569
this.sliderControlWrapper = this.querySelector('.slider-buttons');
this.bannerContents = this.slider.querySelectorAll('.banner__content');
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind having a:

this.elements = {
 // all the variables that you are assigning to a querySelector
}

?

I think we're using this pattern in a few places, but it really helps with legibility. I'm often unsure what is a numeric / boolean variable and what is an element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can take a look together/pair. I feel like some values are also used in SliderComponent and some are based on conditionals. So curious to see what would make the most sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another option would be to standardize adding Element or Node to anything that is an element and the plural for any NodeLists (querySelectorAll).

I'd probably use Node because it's shorter and matches the NodeList object that querySelectorAll returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The elements I have in the constructor now are pretty straight forward so I don't feel like this still applied 🤔
Two are elements and one is an array which it mentions in its name.

assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated

this.sliderItemsToShow = Array.from(this.sliderItems).filter(element => element.clientWidth > 0);
this.sliderLastItem = this.sliderItemsToShow[this.sliderItemsToShow.length - 1];
if( this.sliderItemsToShow.length > 0) this.currentPage = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that this.currentPage = 1; automatically inherited from SliderComponent initialization? Or are there scenarios where this could be initialized with a different value?

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 thought I needed it because it comes up as undefined when I console log it on initialization. But seems to work fine without.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if( this.sliderItemsToShow.length > 0) this.currentPage = 1;
if (this.sliderItemsToShow.length > 0) this.currentPage = 1;

assets/global.js Outdated
this.sliderItemsToShow = Array.from(this.sliderItems).filter(element => element.clientWidth > 0);
this.sliderLastItem = this.sliderItemsToShow[this.sliderItemsToShow.length - 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but isn't that being initialized in initPages on the SliderComponent?

Looks like the same code to me.

    this.sliderItemsToShow = Array.from(this.sliderItems).filter(element => element.clientWidth > 0);
    this.sliderLastItem = this.sliderItemsToShow[this.sliderItemsToShow.length - 1];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is but if I don't do it there, on initialization I get an error as it sees it as undefined. Im guessing the value is declared/updated in the SliderComponent right after Im trying to use in the SlideshowComponent.

assets/global.js Outdated Show resolved Hide resolved
@svinkle
Copy link
Member

svinkle commented Nov 15, 2021

@ludoboludo I just noticed a focus management issue. Ex., when you're on the second slide and you activate the "previous slide" control, the control is set as disabled and focus moves to the top of the DOM.

Instead of setting the control as disabled, could we wrap and load the last slide? This way focus remains on the button as expected. Wrapping may present a better UX and meet user expectations. @melissaperreault @danielvan thoughts?

@tyleralsbury
Copy link
Contributor

tyleralsbury commented Dec 10, 2021

@svinkle

I removed aria-hidden and it seems to break the announcement from what I noticed. When I remove it, it no longer announces the content of the newly appearing content, it doesn't state anything when I switch slides. With aria-hidden as Ludo implemented it, when I switch slides it states the content of the slide "Image slide, Tell your brand..."

I fixed the Dots and Numbers issue - it was broken because of the variable renaming that @LucasLacerdaUX noticed.

tyleralsbury
tyleralsbury previously approved these changes Dec 10, 2021
Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

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

Bugs are fixed. Awaiting UX and a11y approval.

LucasLacerdaUX
LucasLacerdaUX previously approved these changes Dec 10, 2021
Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX left a comment

Choose a reason for hiding this comment

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

Dots/Numbers are now working as expected 👍

@svinkle
Copy link
Member

svinkle commented Dec 13, 2021

@tyleralsbury Is there a new store link I could test these changes with?

}

@media screen and (max-width: 749px) {
.slider-counter__link {
padding: 0 0.7rem;
padding: 0.7rem;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment from Scott on slack that it's addressing:

Before merging I’d like to see a little more padding on the number/bullet controls. Right now they’re 24 by 10. Could we make them 24 by 24? Same for the numbers; make the height the same as the width to add a better touch target/visual focus.

assets/global.js Outdated
@@ -692,6 +692,7 @@ class SlideshowComponent extends SliderComponent {
linkToSlide(event) {
event.preventDefault();
const slideScrollPosition = this.slider.scrollLeft + this.sliderFirstItemNode.clientWidth * (this.sliderControlLinksArray.indexOf(event.currentTarget) + 1 - this.currentPage);
this.slider.setAttribute('aria-live', 'polite');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other comment from Scott I'm addressing:

When the slideshow is set to autoplay and it’s playing, the transition announcement doesn’t happen on number/bullet/arrow press. It does announce after the slideshow is paused from pressing the pause button, arrow/number/bullet press announces the transition.

LucasLacerdaUX
LucasLacerdaUX previously approved these changes Dec 14, 2021
Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX 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 to me :)

tyleralsbury
tyleralsbury previously approved these changes Dec 14, 2021
Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

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

A monumental task! ✅

Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX left a comment

Choose a reason for hiding this comment

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

👍

@ludoboludo ludoboludo merged commit 644e613 into main Dec 14, 2021
@ludoboludo ludoboludo deleted the slideshow-section branch December 14, 2021 20:17
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.

New Slideshow section