bug: input-otp, backspace in an empty box only moves focus instead of clearing the previous box
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 90/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- angular, ios, typescript
调研方向
从 core/src/components/input-otp/input-otp.tsx 开始,检查 onKeyDown 的空框分支以及 onInput 的插入并移位分支。在 iPhone 上使用 Basic Usage 演示,输入三个数字并按 Backspace 即可复现。当 Backspace 能清除空框中的前一个值,并且向已填写的框中输入内容时能替换其值而不移动其余数字,即表示修复完成。
由索引模型根据 Issue 内容生成。
描述
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v9.x (9.0.8, same code on main)
Current Behavior
Happens on iOS (Safari and Capacitor app, on-screen keyboard), not every time. Not reproducible in desktop browsers.
Backspace in an empty box only moves focus to the previous box without clearing it. Since focus moves to the next empty box after each typed character, the first Backspace after typing can end up deleting nothing.
Typing into the now-focused, filled box then inserts the character and shifts the rest right instead of replacing it.
Expected Behavior
Per the docs:
- Backspace: "In an empty box: moves focus back one box and clears its value."
- Typing: "If the current box has a value, override the value with the entered character."
Steps to Reproduce
- On an iPhone, in the Basic Usage demo, type
789(focus is now on box 4) - Press Backspace: focus moves to box 3,
9stays - Type
6: the result is7869instead of786
May take a few tries; it does not happen on every attempt.
Code Reproduction URL
https://ionicframework.com/docs/api/input-otp#basic-usage
Ionic Info
@ionic/core 9.0.8, @ionic/angular 9.0.8, @angular/core 22.2.3, @capacitor/core 8.5.3
Additional Information
The empty-box branch of onKeyDown in core/src/components/input-otp/input-otp.tsx only calls this.focusPrevious(index). It should also clear inputValues[index - 1] and its input ref, call updateValue(event), and preventDefault(). The insert-and-shift branch of onInput contradicts the documented override behavior.
- 主要语言
- TypeScript
- 星标
- 52.7k
- 派生
- 13.3k
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 72
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ionic-team/ionic-framework 的其他 Issue
-
bug: vue swipe cancellation throws when the previous page is missing可能已有人在做 @dandoingdev 于 32 天前认领。 未关闭package: vue type: bug
难度 2/5 1-3 小时 新手友好度 78/100
ionic-team/ionic-framework#31514 · 1 条评论 ·
维护者通常 1 天内回复
-
bug: ion-searchbar input is always labelled "search text"; aria-label on the host is not forwarded可能已有人在做 @HappyKnuckles 于 26 天前认领。 未关闭a11y package: core type: bug
难度 2/5 1-3 小时 新手友好度 84/100
ionic-team/ionic-framework#31492 · 1 条评论 ·
维护者通常 1 天内回复
-
bug: IonTabs throws when a Fragment contains one IonRouterOutlet可能已有人在做 @Benziza 于 67 天前认领。 未关闭package: react type: bug
难度 2/5 1-3 小时 新手友好度 72/100
ionic-team/ionic-framework#31410 · 2 条评论 ·
维护者通常 1 天内回复
-
package: angular type: bug
难度 2/5 1-3 小时 新手友好度 86/100
ionic-team/ionic-framework#31291 · 1 条评论 ·
维护者通常 1 天内回复
-
bug: ion-range: Clicking/Tapping on the Last tick doesn't work可能已有人在做 @RaphaelFakhri 于 8 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 70/100
ionic-team/ionic-framework#30738 ·
维护者通常 1 天内回复
查看 ionic-team/ionic-framework 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
oxidecomputer/skepsis#102 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
voidzero-dev/void#677 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kunchenguid/gh-axi#247 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
lidge-jun/opencodex#8101 · 2 条评论 ·
维护者通常 1 天内回复