Skip to content

Commit

Permalink
Add focus-in event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
nwidynski authored and davidjerleke committed Nov 12, 2023
1 parent 33e9b4d commit 375cbdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/embla-carousel-autoplay/src/components/Autoplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ function Autoplay(userOptions: AutoplayOptionsType = {}): AutoplayType {
}
}

if (options.stopOnFocusIn) {
eventStore.add(root, 'focusin', interaction);
if (!options.stopOnInteraction) eventStore.add(root, 'focusout', reset);
}

eventStore.add(ownerDocument, 'visibilitychange', () => {
if (ownerDocument.visibilityState === 'hidden') {
wasPlaying = playing
Expand Down

0 comments on commit 375cbdd

Please sign in to comment.