ionic-team / ionic-team/ionic-framework
bug: modal with swipe gesture should call onWillDismiss once dismiss is confirmed
- 主要语言
- TypeScript
- 星标
- 52.7k
- 派生
- 13.3k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 51
描述
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.
### Ionic Framework Version
v7.x
### Current Behavior
When swiping to dismiss a modal, `onWillDismiss` is called after modal dismiss animation completes.
### Expected Behavior
`onWillDismiss` should be called as soon as Ionic determines if the modal should be dismissed. For swipe to dismiss, I would expect this to happen after the user lifts their finger off the screen following the swipe to dismiss gesture, if Ionic calculates that the modal should dismiss.
### Steps to Reproduce
1. Run reproduction
2. Swipe to dismiss
3. Observe alert incorrectly presents after animation completes
4. Additionally, observe tapping "close" button correctly presents alert *before* animation starts
### Code Reproduction URL
https://stackblitz.com/edit/u8qciq-6x7ht2?file=src%2Fmain.tsx
### Ionic Info
N/A - running codepen
### Additional Information
Potentially related? https://github.com/ionic-team/ionic-framework/issues/17600
I am tagging this as a bug because when dismissing though a non-swipe button (programmatically or through dismiss button),`onWillDismiss` is correctly called *before* the dismiss animation starts.
This is a problem for my app because I would like to dismiss the keyboard as soon as I know the modal will dismiss, not after the modal finishes animating out.
### Swipe down - Incorrect behavior
https://github.com/ionic-team/ionic-framework/assets/2166114/b6066444-482d-4c80-98b1-766fe6d32a22
### Tap to dismiss - Correct behavior
https://github.com/ionic-team/ionic-framework/assets/2166114/64763dbb-6be0-4725-98b7-1b56a44cdd0b
贡献指南
调研方向
Start by running the reproduction in src/main.tsx from the linked StackBlitz project and compare swipe dismissal with the close-button path. Trace the modal's swipe-confirmation flow and callback timing. Done means onWillDismiss fires immediately after a swipe is confirmed, before the dismiss animation, while the existing button behavior remains unchanged.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100