Skip to content

Preserve native text selection in focused editors - #1403

Merged
ymichael merged 1 commit into
mainfrom
bb/1397-bug-when-focused-in-the-chat-input-cmd-shif-thr_hthbudr4vf
Aug 12, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/1397-bug-when-focused-in-the-chat-input-cmd-shif-thr_hthbudr4vf

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Fixes #1397

Root cause

This is the regression created by #1166's app-first composer dispatch. PromptBoxInternal offers each keydown to AppCommandProvider before TipTap or the browser handles it, so Mod+Shift+ArrowUp/ArrowDown matched thread.previous/next, stopped propagation, and navigated before native selection could run. The later window listener was not the winning layer.

Implementation

  • Treat semantic navigation and deletion keys from an editable target as owned by that target, regardless of modifier combination.
  • Keep arbitration independent of command IDs and configured shortcut literals, so user-customized bindings follow the same rule.
  • Cover arrows, Home/End, PageUp/PageDown, Backspace, and Delete. This preserves character-, word-, line-, document-, and page-wise navigation/selection and deletion conventions across macOS, Windows, and Linux.
  • Preserve Sidebar shortcut does not work while chat input is focused #1162: non-editing app chords still dispatch before the editor keymap, including Mod+Shift+B when rebound to an app command.

Validation

  • Reproduced both directions on clean origin/main: the route changed threads and the selection stayed empty.
  • Live dev-app QA after the fix: Cmd+Shift+Up/Down selected the full multiline draft in both directions, kept editor focus, and stayed on the same thread.
  • Live dev-app QA for Sidebar shortcut does not work while chat input is focused #1162: the ordinary sidebar shortcut fired with composer focus; after rebinding it to Mod+Shift+B, it still toggled the sidebar instead of creating a blockquote.
  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run test --filter=@bb/app --force — 336 files, 2,546 tests passed
  • pnpm exec turbo run lint --filter=@bb/app — 0 errors

AGENT GENERATED: by GPT-5 Codex

@ymichael
ymichael merged commit 0359867 into main Aug 12, 2026
10 checks passed
@ymichael
ymichael deleted the bb/1397-bug-when-focused-in-the-chat-input-cmd-shif-thr_hthbudr4vf branch August 12, 2026 18:33
ryanbbrown added a commit to ryanbbrown/bb that referenced this pull request Aug 13, 2026
ymichael added a commit that referenced this pull request Aug 13, 2026
Fixes #1476

## Summary

- Revert #1403's global exemption for navigation and deletion keys from
editable controls.
- Restore the normal keybinding contract: a configured, context-matching
command runs from the focused composer; unmatched or unhandled events
remain native.
- Add regression coverage for previous/next thread bindings in a focused
textarea and the real prompt editor.

The conflicting shipped arrow-key defaults are intentionally handled in
a separate follow-up PR so this behavioral fix stays independent.

## Validation

- `pnpm exec turbo run typecheck --filter=@bb/app`
- `pnpm exec turbo run test --filter=@bb/app --force` — 340 files, 2,640
tests passed
- `pnpm exec turbo run lint --filter=@bb/app` — 0 errors (149 existing
warnings)

> AGENT GENERATED: by GPT-5 Codex
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.

bug: when focused in the chat input, cmd+shift+up / cmd+shift+down should select text but instead trigger the prev / next thread hotkey

1 participant