Skip to content

Commit

Permalink
Revert "Follow ups for accessibility of announcements slider (Shopify…
Browse files Browse the repository at this point in the history
…#2580)"

This reverts commit af83afd.
  • Loading branch information
Jonas Abrahams committed Jun 6, 2023
1 parent d29576c commit 7d1da5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 50 deletions.
26 changes: 6 additions & 20 deletions assets/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,24 +722,10 @@ class SlideshowComponent extends SliderComponent {
this.slider.addEventListener('scroll', this.setSlideVisibility.bind(this));
this.setSlideVisibility();

if (this.querySelector('.announcement-bar-slider')) {
this.announcementBarArrowButtonWasClicked = false;

this.desktopLayout = window.matchMedia('(min-width: 750px)');
this.reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');

[this.reducedMotion, this.desktopLayout].forEach((mediaQuery) => {
mediaQuery.addEventListener('change', () => {
if (this.slider.getAttribute('data-autoplay') === 'true') this.setAutoPlay();
});
});

[this.prevButton, this.nextButton].forEach((button) => {
button.addEventListener('click', () => {
this.announcementBarArrowButtonWasClicked = true;
}, {once: true});
});
}
this.reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
this.reducedMotion.addEventListener('change', () => {
if (this.slider.getAttribute('data-autoplay') === 'true') this.setAutoPlay();
});

if (this.slider.getAttribute('data-autoplay') === 'true') this.setAutoPlay();
}
Expand All @@ -757,7 +743,7 @@ class SlideshowComponent extends SliderComponent {
this.autoplayButtonIsSetToPlay = true;
this.play();
} else {
this.reducedMotion.matches || this.announcementBarArrowButtonWasClicked || !this.desktopLayout.matches ? this.pause() : this.play();
this.reducedMotion.matches ? this.pause() : this.play();
}
}

Expand Down Expand Up @@ -806,7 +792,7 @@ class SlideshowComponent extends SliderComponent {
event.target === this.sliderAutoplayButton || this.sliderAutoplayButton.contains(event.target);
if (!this.autoplayButtonIsSetToPlay || focusedOnAutoplayButton) return;
this.play();
} else if (!this.reducedMotion.matches && !this.announcementBarArrowButtonWasClicked && this.desktopLayout.matches) {
} else if (!this.reducedMotion.matches) {
this.play();
}
}
Expand Down
30 changes: 0 additions & 30 deletions sections/announcement-bar.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,6 @@
"name": "t:sections.announcement-bar.name",
"max_blocks": 12,
"class": "announcement-bar-section",
"settings": [
{
"type": "color_scheme",
"id": "color_scheme",
"label": "t:sections.all.colors.label",
"default": "accent-1"
},
{
"type": "checkbox",
"id": "show_line_separator",
"default": true,
"label": "t:sections.header.settings.show_line_separator.label"
},
{
"type": "checkbox",
"id": "auto_rotate",
"label": "t:sections.announcement-bar.settings.auto_rotate.label",
"default": false
},
{
"type": "range",
"id": "change_slides_speed",
"min": 5,
"max": 10,
"step": 1,
"unit": "s",
"label": "t:sections.announcement-bar.settings.change_slides_speed.label",
"default": 5
}
],
"blocks": [
{
"type": "announcement",
Expand Down

0 comments on commit 7d1da5f

Please sign in to comment.