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
Prev Previous commit
Next Next commit
Renaming variables in JS.
  • Loading branch information
eugenekasimov committed Apr 28, 2023
commit 9396596a85458a672cd1a3b28b2f1f9c1afe6e3f
12 changes: 6 additions & 6 deletions assets/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ class SlideshowComponent extends SliderComponent {
super();
this.sliderControlWrapper = this.querySelector('.slider-buttons');
this.enableSliderLooping = true;
this.arrowButtonWasInteracted = false;
this.announcementBarArrowButtonWasClicked = false;

if (!this.sliderControlWrapper) return;

Expand Down Expand Up @@ -734,10 +734,10 @@ class SlideshowComponent extends SliderComponent {
this.addEventListener('focusin', this.focusInHandling.bind(this));
this.addEventListener('focusout', this.focusOutHandling.bind(this));

this.sliderArrowButtons = this.querySelectorAll('.announcement-bar-slider .slider-button');
this.sliderArrowButtons.forEach((button) => {
this.announcementSliderArrowButtons = this.querySelectorAll('.announcement-bar-slider .slider-button');
this.announcementSliderArrowButtons.forEach((button) => {
button.addEventListener('click', () => {
this.arrowButtonWasInteracted = true;
this.announcementBarArrowButtonWasClicked = true;
}, {once: true});
});

Expand All @@ -747,7 +747,7 @@ class SlideshowComponent extends SliderComponent {
this.autoplayButtonIsSetToPlay = true;
this.play();
} else {
this.reducedMotion.matches || this.arrowButtonWasInteracted || !this.desktopLayout.matches ? this.pause() : this.play();
this.reducedMotion.matches || this.announcementBarArrowButtonWasClicked || !this.desktopLayout.matches ? this.pause() : this.play();
}
}

Expand Down Expand Up @@ -796,7 +796,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.arrowButtonWasInteracted && this.desktopLayout.matches) {
} else if (!this.reducedMotion.matches && !this.announcementBarArrowButtonWasClicked && this.desktopLayout.matches) {
this.play();
}
}
Expand Down