Numpad Keys Not Working in Prompt Input Field
Description
The numeric keypad (numpad) keys do not work when typing in the prompt input field in MiMo Code. Pressing any key on the numpad (digits 0-9, decimal point, or arithmetic operators like +, -, *, /) produces no input in the text field.
Expected Behavior
Numpad keys should function identically to the main keyboard number keys, inserting the corresponding digits and symbols into the prompt input field.
Actual Behavior
No characters are inserted when pressing numpad keys. The input field remains unchanged.
Reference: Other Applications Work Correctly
This issue appears to be specific to MiMo Code's input handling. The numpad works correctly in:
- OpenCode (the predecessor/fork base of MiMo Code) - numpad inputs work normally
- VS Code terminal and editor
- Windows Notepad, Word, and other native applications
- Web browsers (Chrome, Edge) in text input fields
- Claude Code and other CLI-based coding assistants
This suggests the issue lies in how MiMo Code's input field captures or processes keyboard events, specifically for numpad key codes.
Steps to Reproduce
- Open MiMo Code (Web UI or Desktop app)
- Click on the prompt input field at the bottom
- Ensure NumLock is enabled (numpad should be in number input mode)
- Press any digit key on the numpad (0-9)
- Observe: No digit appears in the input field
- Try the main keyboard number row (above QWERTY)
- Observe: These work correctly and digits appear
Environment
- MiMo Code version: 0.1.0
- Operating System: Windows 11
- Installation method: npm install -g @mimo-ai/cli
- Hardware: Standard keyboard with numeric keypad
- NumLock state: ON (tried both ON and OFF)
Possible Cause (Brief Analysis)
The issue likely stems from how the prompt input field handles keyboard events:
-
Key Code Mapping: MiMo Code may be using
event.keyorevent.codefor keyboard input handling. Numpad keys produce different values:- Main keyboard "1":
event.key = "1",event.code = "Digit1" - Numpad "1":
event.key = "1",event.code = "Numpad1"
If the code checks for
event.code.startsWith("Digit"), it would miss numpad inputs. - Main keyboard "1":
-
ContentEditable Handling: The prompt input appears to use a
contentEditablediv rather than a native<input>element.contentEditableelements have inconsistent behavior with numpad input across browsers and Electron-based apps, especially when combined with custom keyboard event interception. -
IME Composition Handling: The code includes checks for
event.isComposingandevent.keyCode === 229(IME composing state). Numpad inputs during or after IME composition may be incorrectly filtered out. -
PreventDefault Interference: The input field has extensive
handleKeyDownevent handling with manyevent.preventDefault()calls for special keys (Arrow keys, Enter, Escape, etc.). It's possible numpad key events are being inadvertently caught in this net, especially if the numpad Enter key is treated differently than the main Enter key.
The fact that OpenCode (the upstream/base project) does not have this issue suggests this is a regression or a specific change in MiMo Code's input handling implementation.
@nightt5879 I noticed you recently fixed a related issue about prompt history (#392). This numpad input problem also seems to involve keyboard event handling in the prompt input field. Would you mind taking a look? The numpad works fine in OpenCode but not in MiMo Code, suggesting something changed in the input handling implementation.