Skip to content

fix(ui): route text typed with Tab into the file filter - #1221

Open
ShryukGrandhi wants to merge 1 commit into
modem-dev:mainfrom
ShryukGrandhi:fix/issue-1082-typing-immediately-after-tab-can-trigger
Open

ShryukGrandhi wants to merge 1 commit into
modem-dev:mainfrom
ShryukGrandhi:fix/issue-1082-typing-immediately-after-tab-can-trigger

Conversation

@ShryukGrandhi

Copy link
Copy Markdown
Contributor

Summary

When Tab (focus the filter) and the next characters arrive in the same input chunk — a paste, a fast typist on a slow or remote terminal, or a coalesced PTY write — the characters ran as global shortcuts instead of going into the filter. Writing "\tbeta" to the PTY opened the theme selector (t) and left the filter focused but empty.

Tab opens the filter prompt in the status-line store synchronously, but useAppKeyboardShortcuts only treated keys as filter text once a render had refreshed focusAreaRef to "filter". Until then, every key in the chunk fell through to command dispatch.

Fixes #1082

Changes

  • App exposes isFilterPromptOpen(), which reads the status-line store live (the same condition focusArea is derived from), and queueFilterInput(text), which appends to the open filter prompt's value through updatePromptValue.
  • handleFocusedInputShortcut decides filter ownership with that live check instead of the last-rendered focus area. Until the input has rendered, printable keys are appended to the prompt value and consumed. The input then mounts already holding that text, the filter applies through the prompt's existing onChange, and later typing continues after it. Tab still toggles back out on the same named command path.
  • Non-printable keys that arrive before the input mounts are swallowed instead of reaching global navigation. This mirrors how the note draft holds input while its editor mounts.
  • Patch changeset.

This stays in core: it is host keyboard routing for the built-in filter prompt.

Testing

  • New AppHost.interactions.test.tsx case: types "\ttzz" in one act and expects filter: tzz, the no-match message, and no theme selector; typing x afterwards gives filter: tzzx. It fails without the fix (the theme selector opens) and passes with it.
  • New PTY case in test/pty/chrome.test.ts: session.writeRaw("\tbeta") after ensureKeyboardIsLive, waiting for filter: beta with alpha.ts hidden and no theme selector. It fails without the fix and passes with it.
  • bun run typecheck, bun run lint, bun run format:check and bun run deps:check all pass.
  • These files pass when run on their own: AppHost.interactions (83 tests), AppHost.search, AppHost.keybindings, AppHost.keyboard-modes, AppHost.status-line, AppHost.responsive, AppHost.watch, AppHost.file-views, plus ui/hooks, ui/lib and ui/statusLine (739 tests).
  • bun run test as a whole was not usable on this machine. The sharded run, alongside a concurrent typecheck, produced hundreds of blank-frame failures from load; the affected files pass when run alone.
  • PTY tests under load fail intermittently here, and the failing set changes from run to run, on main too. Every PTY test that touches the filter, and every chrome test that failed in a full-file run, passes when run on its own. The one exception is PTY pager > the file filter keeps focus when pager results remount, which fails the same way on unmodified main on this machine (waitForData timed out ... no data received from PTY).
  • Tested on macOS (arm64) only. test:tty-smoke was not run because rendering is unchanged.

Tab opens the filter prompt synchronously, but keyboard routing only
treated keys as filter text once a render observed the filter focus.
Printable keys in the same input chunk as Tab therefore ran global
shortcuts (`t` opened the theme selector) and never reached the filter.

Ask the status-line store whether the filter prompt is open, and append
printable keys to the prompt value until the input mounts with it.

Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

@ShryukGrandhi is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing immediately after Tab can trigger global shortcuts instead of filling the filter

1 participant