fix: complete web pan-down close lifecycle - #2756
Open
huytdps13400 wants to merge 1 commit into
Open
Conversation
Settle the close index when a web gesture reaches the closed detent before its end event. Fixes gorhom#2749
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.
Motivation\n\nA fast downward pan in Safari Web can move the sheet to its closed detent before the gesture end handler runs. Both the web handler and the shared animator then treated the equal target/current position as a no-op, so the modal became visually hidden without emitting onChange(-1), onClose, or onDismiss.\n\n## Changes\n\n- forward an already-reached closed detent from the web gesture end handler\n- settle a gesture-driven close when the pixel position is already reached but the current index is not -1\n- reuse the existing animation completion path so onAnimate, onChange, and onClose retain their normal order\n- preserve no-op behavior for duplicate closes and ordinary same-position operations\n\nFixes #2749\n\n## Verification\n\n- yarn typescript\n- focused Biome lint on both changed files\n- yarn build\n- git diff --check\n- deterministic state-transition probe: original path drops all close callbacks; fixed path emits one onAnimate/onChange/onClose, suppresses duplicate close, and cancels a conflicting animation\n\nThe repository-wide yarn lint currently fails on an existing warning in src/hooks/useBoundingClientRect.ts; neither this PR nor the focused lint touches that file.\n\nA Safari/WebKit runtime pass was not available locally because the checked-in example/package-lock.json is stale relative to example/package.json, so npm ci cannot construct the owner example without rewriting its lockfile. The issue Snack remains the browser reproduction.