Caps Lock key event leaks as raw text `[57358u` into input

Resolved 💬 12 comments Opened Mar 26, 2026 by yutabee Closed Apr 18, 2026

Description

When pressing Caps Lock (e.g. to switch input sources between English/Japanese on macOS with a US keyboard), the Kitty Keyboard Protocol escape sequence for Caps Lock (ESC[57358u) leaks into the Claude Code input field as literal text [57358u.

Steps to Reproduce

  1. Use macOS with a US keyboard layout
  2. Configure Caps Lock as input source switcher (English ↔ Japanese) in System Settings → Keyboard → Input Sources
  3. Open Claude Code in VSCode integrated terminal (VSCode 1.111)
  4. Press Caps Lock to switch input source
  5. Observe [57358u is inserted into the input field

Expected Behavior

Caps Lock key events should be silently consumed and not passed through as text input. Keycode 57358 is the Kitty Keyboard Protocol code for Caps Lock — it should be recognized and ignored.

Actual Behavior

The escape sequence ESC[57358u is partially rendered as [57358u in the input field (the ESC character is invisible, so only [57358u appears).

Environment

  • Claude Code: v2.1.84
  • Terminal: VSCode integrated terminal (v1.111)
  • OS: macOS (Darwin 23.6.0)
  • TERM: xterm-256color
  • Keyboard: US layout, Caps Lock mapped to input source switching

Notes

  • Setting "terminal.integrated.keyboard.protocol": "xterm" in VSCode settings does not resolve the issue, as Claude Code appears to enable the Kitty Keyboard Protocol independently
  • This likely affects other modifier-only key events in the Kitty protocol as well (e.g. Shift, Ctrl, Alt alone)
  • No hidutil key remapping or Karabiner-Elements installed

View original on GitHub ↗

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