ionic-team / ionic-team/ionic-framework

bug: IonAlert hijacks 'insertLineBreak' when using `inputs`

未关闭
#30,811 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
triage
主要语言
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/docs/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

v8.x

### Current Behavior

- IonAlert has an option to add `inputs`.
- When adding checkbox inputs to the ion-alert, on any page in any location, any textarea or other input in which you want to input a linebreak is impossible.
- The ion-alert inputs seem to be hijacking the 'beforeinput' event or the e.inputType === 'insertLineBreak'.
- Having isOpen true or false has no effect.

### Expected Behavior

Linebreaks are possible when an IonAlert with custom inputs are present.

### Steps to Reproduce

### check the code reproduction

1. open or close ion-alert (does not matter)
2. open console and observe the log for the linebreak event
3. type text into the text area and hit enter key for a linebreak
4. toggle inputs for ion-alert from 5 checkboxes to an empty array
5. type text into the text area and hit enter key for a linebreak

### Code Reproduction URL

https://react-9q8cq9kr.stackblitz.io

### Ionic Info

### From my normal project (not the code reproduction repo)
Ionic:

Ionic CLI : 7.2.1 (C:\Users\mysecretusername\AppData\Roaming\nvm\v22.19.0\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 8.7.6

Capacitor:

Capacitor CLI : 7.4.3
@capacitor/android : 7.4.3
@capacitor/core : 7.4.3
@capacitor/ios : 7.4.3

Utility:

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

System:

NodeJS : v22.19.0 (C:\Program Files\nodejs\node.exe)
npm : 10.9.3
OS : Windows 10

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start with the linked StackBlitz reproduction and inspect IonAlert's handling of checkbox inputs around the beforeinput event and insertLineBreak input type. Verify the behavior with the alert open and closed, then with its inputs changed to an empty array. Done means textarea line breaks work in all of those cases while IonAlert inputs remain functional.

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

评估

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

把新 issue 发到你的邮箱

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