Skip to content

fix: stop slider transitions from resetting animations - #488

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/slider-resets-gsap-animations
Aug 6, 2026
Merged

fix: stop slider transitions from resetting animations#488
tristan-mouchet merged 1 commit into
developfrom
fix/slider-resets-gsap-animations

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

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

  • Ignore childList mutations that originate inside a slider ([data-slider-id] / .swiper-wrapper) in the animation remount observer
  • Swiper moves/reshuffles real slide nodes on loop and transition; those moves were mistaken for newly mounted content, triggering a full animation rebind that re-applied every interaction's initial state
  • Genuine dynamically-injected content (filter / load-more) is unaffected — it flows through the separate ITEMS_INJECTED_EVENT path, which still triggers rebinds as before

Test plan

  • Add a slider (loop enabled) and a separate element with a click-toggle animation (e.g. a nav menu that opens on click)
  • Open the toggle, then let the slider advance / click next — the toggle stays open
  • Confirm load / scroll-into-view / hover animations on other elements still play normally
  • Toggle a filter or load-more on a collection and confirm injected items still animate (rebind still works)

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.
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Aug 6, 2026
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Aug 6, 2026
@tristan-mouchet tristan-mouchet self-assigned this Aug 6, 2026
@tristan-mouchet
tristan-mouchet merged commit 302ff7c into develop Aug 6, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant