Add regression test for accordion rapid-click exit animation (#2674)#3725
Draft
mattgperry wants to merge 1 commit into
Draft
Add regression test for accordion rapid-click exit animation (#2674)#3725mattgperry wants to merge 1 commit into
mattgperry wants to merge 1 commit into
Conversation
Covers an accordion item with a keyed motion.section inside AnimatePresence under rapid toggle sequences. Verifies that re-opening mid-exit, closing mid-enter, and 5x rapid toggles all settle into the correct final state. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Adds a Cypress regression test for the accordion rapid-click scenario reported in #2674 (motion.section with an explicit `key` inside `AnimatePresence`, rapidly toggled open/closed).
Investigation
The original CodeSandbox could not be fetched (CloudFlare-blocked), so the test reconstructs the scenario from the reporter's description and screenshots:
The reporter observed visual glitches under rapid clicking and noted that removing the `key` from the `motion.section` resolved it.
I could not reproduce the bug against the current codebase. All three test variants pass (open mid-exit, close mid-enter, 5x rapid toggle) on both React 18 and React 19 without any code changes.
The issue was filed in May 2024, and numerous `AnimatePresence` rapid-switching / re-entry fixes have landed since — likely resolving it transitively:
The test is included as a forward regression gate covering the specific keyed-child accordion pattern, so any future regression in this area would be caught immediately.
Opening as draft because no production code is changed — please confirm whether the bug is indeed considered resolved and the test should land on its own. If it should be closed without merging, that's also fine.
Fixes #2674
Test plan