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

未关闭
#30,502 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript
领域
frontend, mobile

调研方向

在 iOS 上使用链接的 StackBlitz 重现该问题,然后检查 @ionic/core/components/modal.js 以及 PR #29260 和 issue #24583 中的相关工作。比较报告中提到的三个 scrollTop 检查,并验证 card-modal 内容在已过度滚动时可以开始关闭,同时不会引入副作用。

由索引模型根据 Issue 内容生成。

描述

triage
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.

https://github.com/user-attachments/assets/2da594d8-b315-466b-8038-776f5588bff8

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).

https://github.com/user-attachments/assets/813b1908-40f0-4272-abd9-5d54da60d524

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.

主要语言
TypeScript
星标
52.8k
派生
13.3k
平均合并
3 天 1 小时
30 天内合并 PR
86

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ionic-team/ionic-framework 的其他 Issue

查看 ionic-team/ionic-framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。