-
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
Follow ups for accessibility of announcements slider #2580
Conversation
Prevent auto-rotation for mobile. Change settings for auto-rotation.
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.
Are we sure we want to apply the changes to every Slideshow, or is it just for Announcement bar?
If we only want the changes on Announcement bar then it may be time to create another custom component. With the animation changes we will probably need a different component anyway.
@stufreen I agree that we want to create a new component since the announcement bar slider is quite different now from the slide-show component. However, I'd do it as a different task. For now I just apply the current changes to the announcement bar. @melissaperreault @YoannJailin, Do we want to apply below changes to the slideshow section as well? So far they are applied to the announcement bar only.
!update: |
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.
LGTM! 🎉
This issue this PR says it will fix was meant to be the reference for the This PR is based of this feedback made on the other PR #2394 (comment) Do you want me to create an issue to track? |
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 agree with Stu that adding a feature specific logic in a general component class seem a bit off.
But for now we can go with that. We can create an issue and look into a refactor later.
assets/global.js
Outdated
this.sliderArrowButtons.forEach((button) => { | ||
button.addEventListener('click', () => { | ||
this.arrowButtonWasInteracted = true; | ||
}, {once: true}); | ||
}); |
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.
Here I don't think you need to add/create a new event listener. We already have an existing listener on the buttons from the SliderComponent
.
So you could just add the functionality that you need in the onButtonClick
function specifically when it's the announcement bar buttons.
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 know you use the once: true
on the listener you declared but you should be able to run your specific logic just once in onButtonClick
as well by have a check.
Though because it's something that isn't general to slideshows but only in one specific use case (announcement bars), it might be better to keep it separate 🤔
@stufreen do you have a preference yourself ?
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.
LGTM with a couple minor changes
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 small suggestion otherwise looks good 👍
* Stop auto-rotation after first interaction with an arrow button. Prevent auto-rotation for mobile. Change settings for auto-rotation. * Change 'resize' to 'change' and max-width to min-width. * Apply the current changes to the announcement bar only. * Renaming variables in JS. * Add a condition for the announcement bar for JS. * Refactoring JS code. * Refactor JS. * Combine mediaQuery into array.
* shopify/main: (59 commits) [Announcement bar] Add social icons (Shopify#2497) Update theme version to match the pubic release (Shopify#2698) Add release/v10.0.0 branch fixes to main (Shopify#2693) fix default UI for dropdown and mega menu (Shopify#2644) Fix link formatting in Related Products heading (Shopify#2680) Update 2 translation files (Shopify#2637) Enable gift card recipient form by default on featured product section (Shopify#2666) Gift cards/enable recipient form by default (Shopify#2618) Add a Color Scheme setting for Menus-Header (Shopify#2622) Made mobile drawer full width by default-header (Shopify#2625) Allow multiple announcement bars in Header group (Shopify#2619) [Feat Product] Add rating styling sheet (Shopify#2620) Fix password page variables (Shopify#2607) Fix transform applied when it should not for sliders (Shopify#2606) Modify info string for gift card recipient checkbox (Shopify#2588) [3D lift animation] Raise hovered card above adjacent cards (Shopify#2589) Remove fallback color scheme info text (Shopify#2602) Fix CSS specifity issue to cancel animation for theme editor events (Shopify#2605) Remove settings daya for icon color (Shopify#2601) Follow ups for accessibility of announcements slider (Shopify#2580) ...
* Stop auto-rotation after first interaction with an arrow button. Prevent auto-rotation for mobile. Change settings for auto-rotation. * Change 'resize' to 'change' and max-width to min-width. * Apply the current changes to the announcement bar only. * Renaming variables in JS. * Add a condition for the announcement bar for JS. * Refactoring JS code. * Refactor JS. * Combine mediaQuery into array.
PR Summary:
This PR:
Why are these changes introduced?
Fixes #2494
What approach did you take?
Using JS I prevent auto-rotation for mobile and also stop it if a user interacts with an arrow button.
Other considerations
Decision log
Visual impact on existing themes
Testing steps/scenarios
Auto-rotate slides
.Demo links
Checklist