Skip to content

bug: ion-modal card modal is only dismissable from the handle until overscroll settles to top #30502

Open
@lyonzy

Description

@lyonzy

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When using a card modal, you have to be scrolled to exactly the top (no higher) to be able to drag down on the content to dismiss. If the content has overscrolled/bounced "above" the top you have to wait for it to settle back to 0 before you can dismiss by dragging the content.

I've attached a video - notice at the top it really wants to keep scrolling into the overscroll area, when you'd expect it to be dismissing the modal.

FGFG5495.MP4

Expected Behavior

The default iOS behaviour seems to be that if you're in the overscroll area you can drag down to dismiss, and the content and top of the sheet will try to snap back together as you do. Here's a video of how it works after I went into @ionic/core/components/modal.js inside node_modules and wherever I saw scrollTop === 0 I replaced it with scrollTop <= 0. Now when it's overscrolled at the top it allows drag to dismiss, and to me it makes it a bunch easier to dismiss the modal (as well as being consistent with native behaviour).

JSKP2325.MP4

Steps to Reproduce

Open the attached StackBlitz on an iOS device (hopefully it runs on an iPhone, I didn't have much luck so I built a local copy).
Open the modal and try scrolling before it's settled at exactly the top (vaguely but not 100% aligned with when the thin scrollbar is shown).

Code Reproduction URL

https://stackblitz.com/edit/2xkdprpz

Ionic Info

Probably mostly irrelevant:

[WARN] You are not in an Ionic project directory. Project context may be missing.

Ionic:

Ionic CLI : 5.4.16

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v20.19.2
npm : 10.8.2
OS : Linux 6.6

Additional Information

There's some related work here and here. Also there were 3 spots where I changed scrollTop === 0 to scrollTop <= 0 but I haven't dug far enough to know whether they're all needed or whether there's any side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions