fix: support Android IME mask input - #1005
Conversation
|
@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. Walkthrough变更概述Input 组件支持 Android 虚拟键盘的 ChangesAndroid IME 掩码输入
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Android masked-input handling now accepts characters and deletion from native IME events while preserving the existing formatting and validation behavior. Regression coverage is included, and no actionable merge-blocking risk remains beyond normal checks. Sequence Diagram(s)sequenceDiagram
participant AndroidIME
participant Input
participant triggerFormatKey
participant Picker
AndroidIME->>Input: 发送 keydown(Unidentified)
Input->>Input: 设置 nativeInputRef
AndroidIME->>Input: 发送 input(inputType, data)
Input->>triggerFormatKey: 映射字符或删除操作
triggerFormatKey->>Picker: 更新掩码输入
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
inputevent when Android virtual keyboards reportevent.keyasUnidentifiedWhy
Masked picker input currently relies on
keydownto identify numeric keys. Android IMEs such as Gboard and SwiftKey can reportUnidentified, so the mask handler ignores the character even though the following native input event contains it.The fallback is narrowly gated to an immediately preceding
Unidentifiedkeydown. Ordinary keyboard input continues through the existing keydown path, avoiding duplicate processing.Fixes #929.
Validation
npm test -- --runInBand— 15/15 suites, 470 passed, 2 skipped, 29 snapshotsgit diff --checknpm run lint:tscreaches only the existing deprecated Jest matcher type errors intests/picker.spec.tsx; the exact base reproduces the same errorsAI assistance disclosure: Codex was used to trace the masked-input event flow, implement the fallback, and draft regression tests. I verified the failure on current master before the fix and ran the validation above on the submitted commit.
Summary by CodeRabbit
Bug Fixes
Tests