Skip to content

fix(modal): use drag distance for sheet dismissal - #31524

Merged
OS-susmitabhowmik merged 15 commits into
nextfrom
ROU-13053-fix-modal-sheet-dismissal
Oct 9, 2026
Merged

OS-susmitabhowmik merged 15 commits into
nextfrom
ROU-13053-fix-modal-sheet-dismissal

Conversation

@OS-susmitabhowmik

@OS-susmitabhowmik OS-susmitabhowmik commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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.

A quick downward flick still dismisses, because the drag is projected forward by its velocity before snapping to the nearest breakpoint. A small, slow drag snaps the sheet back instead of closing it.

Event progress (ionDragMove/ionDragEnd) is now normalized to 0 at the lowest breakpoint and 1 at the highest, matching the documented contract.

Additionally, the Ionic theme's physics-based gesture is refactored to use the fixed progress calculation. Velocity constants are renamed to describe the gesture direction (FLICK_DOWN_VELOCITY, FLICK_UP_VELOCITY) rather than the outcome. The redundant velocity check in the 40% dismissal rule is removed, so medium-speed downward drags past the threshold now dismiss instead of snapping back.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@OS-susmitabhowmik OS-susmitabhowmik added the type: bug a confirmed bug report label Oct 2, 2026
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Oct 9, 2026 6:42pm UTC

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Oct 2, 2026
@OS-susmitabhowmik
OS-susmitabhowmik marked this pull request as ready for review October 2, 2026 21:18
@OS-susmitabhowmik
OS-susmitabhowmik requested a review from a team as a code owner October 2, 2026 21:18
@OS-susmitabhowmik
OS-susmitabhowmik requested review from thetaPC and removed request for brandyscarney October 5, 2026 21:46

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down! Fixing progress to use the drag distance is the right call. I left a few line comments, mostly about the early return 0 for sheets with only 0 and 1 breakpoints.

Two other things:

  • main has the same bug since 8.8.0 (#30962), so it ships in 8.8.x and 9.0.x too. Should the progress fix target main, with the physics-based part handled when main syncs into next?
  • The PR title is 83 characters, and CONTRIBUTING caps commit headers at 50. Maybe fix(modal): stop sheets dismissing on upward drags?

Comment thread core/src/components/modal/gestures/sheet.ts Outdated
Comment thread core/src/components/modal/gestures/sheet.ts
Comment thread core/src/components/modal/test/sheet/index.html Outdated
Comment thread core/src/components/modal/test/sheet/modal.e2e.ts
Comment thread core/src/components/modal/gestures/sheet.ts Outdated
Comment thread core/src/components/modal/gestures/sheet.ts Outdated
Comment thread core/src/components/modal/gestures/sheet.ts Outdated
Comment thread core/src/components/modal/test/sheet/index.html Outdated
@OS-susmitabhowmik
OS-susmitabhowmik changed the base branch from next to main October 7, 2026 23:56
@OS-susmitabhowmik
OS-susmitabhowmik changed the base branch from main to next October 7, 2026 23:56
@OS-susmitabhowmik OS-susmitabhowmik changed the title fix(modal): derive sheet dismissal from drag distance rather than viewport position fix(modal): stop sheets dismissing on upward drags Oct 8, 2026
@OS-susmitabhowmik OS-susmitabhowmik changed the title fix(modal): stop sheets dismissing on upward drags fix(modal): use drag distance for sheet dismissal Oct 8, 2026
@github-actions github-actions Bot added the package: react @ionic/react package label Oct 8, 2026
@github-actions github-actions Bot removed the package: react @ionic/react package label Oct 8, 2026
@OS-susmitabhowmik

Copy link
Copy Markdown
Contributor Author

Thanks for tracking this down! Fixing progress to use the drag distance is the right call. I left a few line comments, mostly about the early return 0 for sheets with only 0 and 1 breakpoints.

Two other things:

  • main has the same bug since 8.8.0 (feat(modal): add drag events for sheet and card modals #30962), so it ships in 8.8.x and 9.0.x too. Should the progress fix target main, with the physics-based part handled when main syncs into next?
  • The PR title is 83 characters, and CONTRIBUTING caps commit headers at 50. Maybe fix(modal): stop sheets dismissing on upward drags?

@thetaPC Thank you for the thorough review! I've applied your suggestions and also created a separate PR to add the progress based fix to target main (#31553). Could you please take another look at this PR as well as the new PR targeting main?

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OS-susmitabhowmik
OS-susmitabhowmik merged commit fdab3cd into next Oct 9, 2026
54 checks passed
@OS-susmitabhowmik
OS-susmitabhowmik deleted the ROU-13053-fix-modal-sheet-dismissal branch October 9, 2026 18:57
OS-susmitabhowmik added a commit that referenced this pull request Oct 9, 2026
Issue number: resolves internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

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.

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.

A quick downward flick still dismisses, because the drag is projected
forward by its velocity before snapping to the nearest breakpoint. A
small, slow drag snaps the sheet back instead of closing it.

Event progress (`ionDragMove`/`ionDragEnd`) is now normalized to 0 at
the lowest breakpoint and 1 at the highest, matching the documented
contract.

Additionally, the Ionic theme's physics-based gesture is refactored to
use the fixed progress calculation. Velocity constants are renamed to
describe the gesture direction (`FLICK_DOWN_VELOCITY`,
`FLICK_UP_VELOCITY`) rather than the outcome. The redundant velocity
check in the 40% dismissal rule is removed, so medium-speed downward
drags past the threshold now dismiss instead of snapping back.

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->

- [Sheet Modal Test
Page](https://ionic-framework-git-rou-13053-fix-modal-sheet-dismissal-ionic1.vercel.app/src/components/modal/test/sheet/)

---------

Co-authored-by: ionitron <hi@ionicframework.com>

This branch was successfully deployed

1 active deployment
Preview — 7263eb01 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package type: bug a confirmed bug report

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants