Mod API: deliver arrow keys (← →) to a focused pane or Client

Status Open
Reported on v2.1.289
Maintainer reply None cached
Activity 0 comments · opened Oct 4, 2026

What I want

Let a mod read ← and → (and ideally all arrow keys) while its pane or a Client element has focus.

Why

I build glowup, a mod with a pane that has tabs along the top (Changes, Agents, Plan & context). Switching tabs with ← / → is what every terminal UI does, and users try it first. Today it does nothing, and the mod has no way to know the key was pressed. The same gap blocks any horizontal navigation in a mod pane: tab bars, carousels, sliders, a grid of choices, a little game.

What happens now (Claude Code 2.1.289, Linux, Konsole)

In a pane opened with $.ui.open({ focus: true }):

  • ↑ / ↓ move the pane's focus ring through a flat list (previous and next), regardless of screen position.
  • ← / → do nothing, and no event reaches the mod.
  • A Client with onKey receives no keys, before or after clicking it.
  • prompt.edit only carries keys that change the draft, so arrows never arrive there either.

What would solve it

Any one of these:

  1. Deliver key events (including arrows) to a focused Client's onKey.
  2. A ui.key event (or ui.press with a direction) for the focused pane, carrying the key name, which a mod can handle or pass on with next(e).
  3. Make the pane's focus ring spatial, so ← / → move focus to the element to the left or right, and emit ui.focus as ↑ / ↓ already do.

Option 2 is the most general: a mod returns without calling next to consume the key, and Claude Code's own handling stays the default.

View original on GitHub ↗