fix: stop slider transitions from resetting animations - #488
Merged
Conversation
Swiper moves/reshuffles slide nodes on loop and transition, which the animation MutationObserver saw as new content and treated as a remount, rebinding all interactions and re-applying their initial from-state. That reset user-toggled click/hover states elsewhere on the page (e.g. an open nav menu) whenever a slider advanced. Ignore childList mutations that originate inside a slider so only genuine remounts trigger a rebind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A slider advancing to the next slide could reset unrelated GSAP animations on the page — for example, closing an open navigation menu. This fixes that interference so animations keep their state while a slider transitions.
Changes
childListmutations that originate inside a slider ([data-slider-id]/.swiper-wrapper) in the animation remount observerITEMS_INJECTED_EVENTpath, which still triggers rebinds as beforeTest plan