aarsteinmedia / dotlottie-player-light

Light Web Component for playing SVG Lottie animations in your web app. Previously @johanaarstein/dotlottie-player-light
GNU General Public License v2.0
4 stars 1 forks source link

Remove capture from focus and blur events to prevent the lottie player from pausing on any blur from any element in the page #2

Closed anthony-colpron closed 5 months ago

anthony-colpron commented 5 months ago

Adding an event listener with capture: true on the Window element makes every single event of that type trigger the handler.

Therefore, any blur on any element in a page containing one or several dotlottie-player or dotlottie-player-light will call the _handleWindowBlur method on every last one of them and pause them all.

You can see an example of this on your demo page. If you click a button and then click anywhere else in the page (thus triggering the blur event on the button), the demo player will pause.

johanaarstein commented 5 months ago

Thanks! 😎