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

Follow ups for accessibility of announcements slider #2580

Merged
merged 8 commits into from
May 2, 2023

Conversation

eugenekasimov
Copy link
Contributor

@eugenekasimov eugenekasimov commented Apr 27, 2023

PR Summary:

This PR:

  • changes settings of auto-rotation for announcements. Min speed is 5 sec, max is 10 sec, off for default.
  • prevents auto-rotation for mobile.
  • stops auto-rotation after first interaction with an arrow button.

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

  • Add a few announcements to the announcement bar.
  • In the settings set Auto-rotate slides.
  • Change the screen size to mobile and make sure that the slider stops rotation, then resize the screen back and make sure the slider continues rotating. (! while testing this don't interact with arrow buttons since this will stop the slider).
  • Interact with an arrow button and make sure that the slider stops rotating. Resize the screen to mobile and back and make sure it doesn't resume rotating.

Demo links

Checklist

Prevent auto-rotation for mobile.

Change settings for auto-rotation.
@eugenekasimov eugenekasimov self-assigned this Apr 27, 2023
Copy link
Contributor

@stufreen stufreen left a 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.

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

eugenekasimov commented Apr 27, 2023

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.

  • prevents auto-rotation for mobile.
  • stops auto-rotation after first interaction with an arrow button.

!update:
@melissaperreault confirmed that we would want to apply these changes to the slideshow section as well. We'll create a separate issue for that and it's going to be a different PR.

Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@melissaperreault
Copy link
Contributor

This issue this PR says it will fix was meant to be the reference for the Slideshow section though #2494

This PR is based of this feedback made on the other PR #2394 (comment)

Do you want me to create an issue to track?

@ludoboludo ludoboludo self-requested a review April 28, 2023 13:42
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.

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 Show resolved Hide resolved
assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated
Comment on lines 738 to 742
this.sliderArrowButtons.forEach((button) => {
button.addEventListener('click', () => {
this.arrowButtonWasInteracted = true;
}, {once: true});
});
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Video explanation.

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 ?

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

@stufreen stufreen left a 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

assets/global.js Outdated Show resolved Hide resolved
assets/global.js Outdated Show resolved Hide resolved
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.

One small suggestion otherwise looks good 👍

assets/global.js Show resolved Hide resolved
@eugenekasimov eugenekasimov merged commit 39e020b into main May 2, 2023
@eugenekasimov eugenekasimov deleted the improve-accessibility-announcement-bar branch May 2, 2023 18:32
jabrms pushed a commit to fp-trading/fp-trading-theme that referenced this pull request Jun 6, 2023
* 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.
jabrms pushed a commit to fp-trading/fp-trading-theme that referenced this pull request Jun 12, 2023
pangloss added a commit to pangloss/dawn that referenced this pull request Jun 14, 2023
* 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)
  ...
@kjellr kjellr mentioned this pull request Jul 10, 2023
8 tasks
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* 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.
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.

[Slideshow] Stop auto-rotating slides when user interacts with its controls
4 participants