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

Add focus interaction to autoplay #615

Merged
merged 4 commits into from
Nov 12, 2023
Merged

Add focus interaction to autoplay #615

merged 4 commits into from
Nov 12, 2023

Conversation

nwidynski
Copy link
Contributor

@nwidynski nwidynski commented Nov 1, 2023

Feature request is related to

  • embla-carousel-autoplay (plugin)

A clear and concise description of what the problem is.

The current implementation of stopOnInteraction does not stop if focus is received by a nested element.

Describe the solution you'd like

This PR adds event handlers to the autoplay plugin to stop the autoplay if a bubbled up focus event is received by the root element.

@davidjerleke
Copy link
Owner

Hi @nwidynski,

I think this is a good idea. Thank you for your efforts! I will test this when I get the chance and get back to you.

Best,
David

@davidjerleke davidjerleke added the feature request New feature or request label Nov 2, 2023
@davidjerleke davidjerleke linked an issue Nov 2, 2023 that may be closed by this pull request
1 task
@davidjerleke davidjerleke changed the title Feat: Stop autoplay on focus of slide elements Add focus interaction to autoplay Nov 2, 2023
@davidjerleke
Copy link
Owner

davidjerleke commented Nov 2, 2023

Hi @nwidynski,

I just tested this and it's working well except one bug. To reproduce:

  • Add a focusable element (a link) inside each slide.
  • Set the following option: stopOnInteraction: false.
  • Let autoplay scroll past the first slide.
  • Tab to the link in the first slide so it receives focus.
  • Click with the mouse outside the carousel to remove focus.
  • When autoplay plays again, the first time it won't animate the slide change.

At the time of writing I don't know what's causing this so we'll have to investigate it a bit before we can merge this.

Best,
David

@davidjerleke
Copy link
Owner

davidjerleke commented Nov 12, 2023

@nwidynski I found the culprit. I will share more information soon about how to proceed with this PR. Thank you for your patience.

@davidjerleke davidjerleke merged commit 329b9fb into davidjerleke:master Nov 12, 2023
@davidjerleke
Copy link
Owner

@nwidynski thank you for your contribution ⭐!

@davidjerleke davidjerleke added the resolved This issue is resolved label Nov 12, 2023
@davidjerleke
Copy link
Owner

@nwidynski I've released v8.0.0-rc15 which includes this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request resolved This issue is resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add focus interaction to autoplay
2 participants