Skip to content

[BUG] The animation breaks when quickly switching between tabs #2684

Description

@dmnlgn

1. Describe the bug

If I switch the tab to another one and quickly switch back to the previous one, then 'exit' does not run and all the contents inside the tab do not show up

2. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/sandbox/framer-motion-layout-animations-forked-x772fv

3. Steps to reproduce

If you are on 'Tomato' tab, then click tab 'Lettuce' and then quickly click 'Tomato' tab again

5. Expected behavior

The animation must be completed correctly and the content must always be shown

6. Video or screenshots

2024-05-27.20-32-47.mp4

"framer-motion": "11.2.6",

Activity

  1. pklada commented on May 28, 2024

    @pklada

    Looks like this bug: #2554

  2. mattgperry commented on Oct 6, 2026

    @mattgperry
    Collaborator

    Closing as fixed in the meantime. Your sandbox isn't reachable from here, so I rebuilt the "layout animations" tabs example it was forked from: a layoutId underline plus AnimatePresence mode="wait" around the tab content keyed by the selected tab. The Playwright test clicks Lettuce then Tomato 50ms apart and checks the Tomato content is shown at full opacity. On framer-motion 11.2.6 (your version) the content area is empty, matching your video. On current main the content shows correctly on React 18 and 19. If you still see this on the latest version, please reopen with a reproduction.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions