Repository navigation
Conversation
|
@HerrDerb is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
Reset the swipe gesture when the menu opens or closes from code. A pointer that went down before the animation has already passed canStart, so moving it past the threshold called beforeAnimation a second time and threw "_before() should not be called while animating". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HerrDerb
force-pushed
the
menu-cancel-pending-swipe-on-programmatic-animation
branch
from
November 26, 2026 11:10
e8d5967 to
c32ec51
Compare
This branch has not been deployed
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.
Issue number: resolves #31839
What is the current behavior?
ion-menuthrowsASSERT: _before() should not be called while animatingwhen the menu is opened or closed from code (open(),close(),toggle(), a backdrop click) while a pointer that went down before is still on the screen, and that pointer then moves.The swipe gesture checks
canStart()only on pointer down, when the menu is not animating yet. When the pointer passes the threshold during the animation, the gesture is captured andonWillStart()callsbeforeAnimation()a second time.What is the new behavior?
_setOpen()resets the swipe gesture before it starts an animation (gesture.enable(false), thengesture.enable(swipeGesture)). A pointer that went down before the animation no longer becomes a swipe, sobeforeAnimation()is not called twice.menu/test/gesture: the pointer goes down, the menu opens or closes from code, then the pointer drags. Both cases throw onmainin Chromium, Firefox and WebKit and pass with this change. The test page loads withionic:_testing=false, because the race needs a running animation.Does this introduce a breaking change?
Other information
A check for
isAnimatinginonWillStart()alone would not be enough: the gesture would still callonStart()andonMove()on the animation started from code.Reproduction app: https://github.com/HerrDerb/ionic-framework/tree/menu-swipe-race-reproduction