Closed raulpesilva closed 2 years ago
Hi @raulpesilva,
Thank you for your pull request. I'm currently working on v7 of Embla so the response time is longer than I would like it it be. I'll get back to you when I've had the chance to check this out.
Best, David
Hi @raulpesilva, I'm sorry for the delayed response. I've released v7 now so I finally got some time off to check this PR out.
First of all, thank you for your contribution. I also want to give you kudos for following the Embla code style. You've clearly aligned your plugin with the way the other plugins are written.
A friendly reminder: Please read the contribution guidelines before making a contribution. You've clearly followed the code style so that's not the reason why I'm bringing this up. It's because of this:
Discuss:
Open an issue before starting any significant work.
And the reason for this is actually to spare contributors from possibly doing unnecessary work. This is why:
I have two concerns about this plugin and both are related to breaking accessibility of the carousel:
dragFree: true
.I've included a screen recording that demonstrates problem 1 and 2:
Have you tried embla.clickAllowed()
instead? Because it's there for this very reason. It checks if the user dragged or statically clicked the carousel. Here's embla.clickAllowed()
in action:
Example code:
embla.slideNodes().forEach((slideNode, index) => {
slideNode.addEventListener('click', () => {
if (!embla.clickAllowed()) return
console.log(`Click allowed: You clicked on slide with ${index + 1}`)
})
})
Is this what you want to achieve?
Best, David