fix(modal): derive sheet dismissal from drag distance rather than viewport position - #31524
Open
OS-susmitabhowmik wants to merge 8 commits into
Open
OS-susmitabhowmik wants to merge 8 commits into
OS-susmitabhowmik wants to merge 8 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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 internal
What is the current behavior?
Dragging a sheet modal upwards dismisses it, depending on where the user's pointer is relative to the viewport height rather than how far they dragged. It happens when the pointer is in the bottom half of the viewport, so it's most noticeable on smaller sheet modals where the whole sheet sits in that area. Swiping up should scroll the content, or expand the sheet if it isn't at its largest breakpoint yet.
What is the new behavior?
Dragging a sheet upwards no longer dismisses it. How open the sheet is now comes from the drag distance over the sheet's own height, so the breakpoint it snaps to and the position it's drawn at come from the same measurement. Sheets with breakpoints in between snap to the nearest one.
Sheets whose only breakpoints are 0 and 1 maintain the current behavior of dismissing on any downward drag. A drag that ends in an upward flick still reopens the sheet, and sheets using
canDismisskeep the existing thresholds so an accidental drag can't trigger their callback.Does this introduce a breaking change?
Other information