Caps Lock key inputs raw escape sequence [57358u instead of being handled

Resolved 💬 5 comments Opened Mar 26, 2026 by simon4agentic Closed Apr 18, 2026

Bug Description

Pressing the Caps Lock key in Claude Code inserts the raw Kitty keyboard protocol escape sequence [57358u into the input field instead of being silently consumed.

Context

On macOS, Caps Lock is commonly used to switch between input methods (e.g., English ↔ Chinese/Japanese/Korean). This is a default macOS behavior configured in System Settings → Keyboard → Input Sources → "Use Caps Lock to switch input source".

Because Claude Code doesn't handle the Caps Lock keycode (57358) from the Kitty keyboard protocol, every time a user switches input methods, the raw escape sequence leaks into the prompt input.

Steps to Reproduce

  1. Use a terminal that supports the Kitty keyboard protocol (e.g., iTerm2, Ghostty, Kitty, WezTerm)
  2. Configure macOS to use Caps Lock to switch input methods (this is the default for CJK users)
  3. Open Claude Code
  4. Press Caps Lock to switch input method
  5. Observe [57358u inserted into the input field

Expected Behavior

Caps Lock key events should be silently consumed (no text inserted), similar to how other modifier keys (Shift, Control, Option) are handled.

Environment

  • OS: macOS (Darwin 25.3.0)
  • Terminal: Kitty protocol-enabled terminal
  • Input method: macOS built-in Chinese input method, switching via Caps Lock

Impact

This affects all macOS CJK (Chinese, Japanese, Korean) users who rely on Caps Lock for input method switching, which is the default macOS configuration. Users must manually delete the leaked escape sequence every time they switch languages, significantly disrupting the workflow.

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗