Navigating with arrow keys affects all carousels, not just the carousel in focus
See original GitHub issueI’m creating a few Glide sliders on the page like so:
import Glide from '@glidejs/glide';
const sliders = document.querySelectorAll('.glide');
sliders.forEach((slider) => {
new Glide(slider).mount();
});
The sliders all work perfectly well independently, but when I try to focus on one and navigate with the keyboard, all of the sliders are affected and change to either the next or previous slide.
Pressing the arrow keys should only affect the slider that the user is focused into.
From inspecting the source code it looks like this may be because Glide is attaching a keyup
listener on the document
element, rather on each individual .glide
element.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:8
Top Results From Across the Web
Controls & Interaction • Carousels • WAI Web ... - W3C
In the first steps the slide show is prepared to hide all content but the first slide. Then “left” and “right” arrows are...
Read more >If you must use a carousel, make it accessible - Alison Walden
Sighted users perceive carousel content as a series of panels usually navigated via arrow buttons. The main carousel accessibility consideration for sighted ...
Read more >How to build a more accessible carousel or slider
Many carousels do not hide their non-visible slides from all users, ... Don't use custom keyboard controls, like arrow keys for navigation.
Read more >Accessibility - Splide
From the version 4, custom keyboard shortcuts, such as arrow keys to move a carousel, are disabled by default, but only the shortcuts...
Read more >Creating an Accessible Image Carousel
Carousels don't have to be bad, but we have a culture of making them ... Focus the carousel and use your arrow keys...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Disable keyboard events globally for Glide and then attach specific events when you mount the individual sliders.
Mmmh, using
keyup
eventListener will let me use keyboard. I have to click on the carousel to get he keyboard enabled.Did someone had the same problem and fixed it?
Thanks