question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoplay timer keeps running, even when viewport is inactive

See original GitHub issue

Bug is related to

  • embla-carousel (core package)
  • embla-carousel-react
  • embla-carousel-autoplay
  • embla-carousel-docs (documentation website)

Embla Carousel version

  • embla-carousel-autoplay: v6.0.2
  • embla-carousel-react: v6.0.2

Describe the bug

The bug seems to cause two problems.

Rushing through slides on reactivation of viewport

After having the carousel with autoplay in an inactive viewport (tab which is not displayed) and activating it again (coming back to the tab) after a while (10mins for example), you can see how the carousel rushes through several slides until it catches up with the timer.

https://user-images.githubusercontent.com/1105080/149907898-f7a3bdf0-038c-4362-9a4b-f6b36fc98dd2.mp4

Carousel disappears entirely

When leaving the carousel with autoplay for even longer in the background, the carousel will disappear. The reason for this is that the transform style on the carousel container has such a high negative value to move in in the x axis, that some browsers (Firefox especially) refuses to render the whole <div>.

2022-01-16_17-11

CodeSandbox

Steps to reproduce

  1. Open CodeSandbox mentioned above
  2. Leave the tab for some time in the background
  3. Come back to the tab and see the carousel rushing through the slides for a while

Expected behavior

  • The timer should be stopped, when the carousel is inactive.

Additional context

Problem observed with image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
davidjerlekecommented, Jan 19, 2022

Hi @openscript,

This problem should be fixed in v6.1.1. Please try it out and let me know if it solves the problem.

Best, David

1reaction
openscriptcommented, May 25, 2022

Hi David @davidjerleke

Thank you so much for the quick fix. It solves the problem 😃

Robin

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to play audio in REACT app while browser tab is inactive?
The timer runs in a component built with reacts bootstrap modal component. If the browser tab in which the app is running is...
Read more >
Autoplay policy in Chrome - Chrome Developers
Chrome's autoplay policies are simple: Muted autoplay is always allowed. Autoplay with sound is allowed if: The user has interacted with the ...
Read more >
Fully Kiosk Browser & App Lockdown Help
Fully Kiosk app will help you to run the selected websites or apps in the kiosk mode. ... Auto reload on idle, on...
Read more >
Implementing UAAG 2.0 - W3C
Note: Platform conventions will dictate whether or not keyboard focus in an inactive viewport is visually indicated by an inactive cursor.
Read more >
Safari Technology Preview Release Notes - Apple Developer
Changed to keep MediaKeySystemAccess alive in a createMediaKeys() async task ... in a muted video element outside the viewport (251596@main); Fixed autoplay ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found