Summary
While composing text with an IME in the Cmd-K palette search field, pressing Enter to confirm the composition also selects the highlighted bb result and closes the palette. Enter should commit the IME candidate only; result selection should wait for a non-composing Enter event.
Versions and environment
- bb 0.42.0
- Source at commit
8ac123f3551e7502a91c93e87329797f34ee626b (origin/main)
- macOS 26.3 (25D125), Chinese Pinyin IME
- Node v24.6.0
- Managed worktree environment
Steps to reproduce
- Open the bb app on macOS with the Chinese Pinyin input source active.
- Press Cmd-K to open the command palette.
- Type into the search field while leaving a bb result highlighted and the IME candidate window active.
- Press Enter to confirm the highlighted IME candidate.
A deterministic component-level reproduction dispatches keydown with { key: "Enter", isComposing: true } to the real Cmd-K combobox after a result is highlighted.
Expected vs actual
Expected:
Pressing Enter while isComposing is true confirms the IME candidate. The palette remains open and does not run or navigate to a bb result.
Actual:
The palette consumes Enter, selects the highlighted command or thread, and closes.
The targeted regression test failed twice before the diagnostic guard:
FAIL src/components/commands/CommandPalette.test.tsx > CommandPalette > does not run the highlighted command when Enter confirms an IME composition
TestingLibraryElementError: Unable to find an accessible element with the role "combobox"
Test Files 1 failed (1)
Tests 1 failed | 23 skipped (24)
Evidence
- Investigation thread:
thr_45jjczbvhq (project proj_7q2p9ejasx, environment env_t9aupz56py)
- The input wires
onKeyDown directly to handleKeyDown:
|
className="h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground" |
|
placeholder={inputLabel} |
|
value={query} |
|
onChange={(event) => { |
|
const nextQuery = event.target.value; |
|
setQuery(nextQuery); |
|
if (!nextQuery.startsWith(">")) setThreadItems([]); |
|
setHighlightedIndex(0); |
|
if (listRef.current !== null) listRef.current.scrollTop = 0; |
|
}} |
|
onKeyDown={handleKeyDown} |
- The Enter branch selects the active result without checking composition state:
|
if (event.key === "Enter") { |
|
event.preventDefault(); |
|
if (mode === "commands") { |
|
const choice = rankedCommands[activeIndex]; |
|
if (choice !== undefined) chooseAction(choice.action); |
|
return; |
|
} |
|
const choice = threadItems[activeIndex]; |
|
if (choice !== undefined) chooseThread(choice); |
- Other text inputs already guard Enter with
event.nativeEvent.isComposing:
|
const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => { |
|
if (event.nativeEvent.isComposing) { |
|
return; |
|
} |
|
if (event.key === "Enter") { |
|
event.preventDefault(); |
|
event.stopPropagation(); |
|
closeOnce(onSubmit); |
- Adding only
if (event.nativeEvent.isComposing) return; at the start of this handler made the same targeted test pass: 1 passed | 23 skipped.
What you ruled out
- Not caused by Dialog or global shortcut handling: changing only the local
CommandPalette handler made the exact reproduction pass.
- Still present on
origin/main at 8ac123f3551e7502a91c93e87329797f34ee626b.
- Searched open and closed issues for IME, composition, Pinyin, command palette, and Cmd-K Enter; no duplicate found.
Suggested priority and effort
Medium priority, low effort. It affects IME users whenever Enter is used to confirm composition; switching input sources is a workaround. No data loss observed.
AGENT GENERATED
Summary
While composing text with an IME in the Cmd-K palette search field, pressing Enter to confirm the composition also selects the highlighted bb result and closes the palette. Enter should commit the IME candidate only; result selection should wait for a non-composing Enter event.
Versions and environment
8ac123f3551e7502a91c93e87329797f34ee626b(origin/main)Steps to reproduce
A deterministic component-level reproduction dispatches
keydownwith{ key: "Enter", isComposing: true }to the real Cmd-K combobox after a result is highlighted.Expected vs actual
Expected:
Pressing Enter while
isComposingis true confirms the IME candidate. The palette remains open and does not run or navigate to a bb result.Actual:
The palette consumes Enter, selects the highlighted command or thread, and closes.
The targeted regression test failed twice before the diagnostic guard:
Evidence
thr_45jjczbvhq(projectproj_7q2p9ejasx, environmentenv_t9aupz56py)onKeyDowndirectly tohandleKeyDown:bb/apps/app/src/components/commands/CommandPalette.tsx
Lines 350 to 360 in 8ac123f
bb/apps/app/src/components/commands/CommandPalette.tsx
Lines 294 to 302 in 8ac123f
event.nativeEvent.isComposing:bb/apps/app/src/components/thread/InlineThreadTitle.tsx
Lines 62 to 69 in 8ac123f
if (event.nativeEvent.isComposing) return;at the start of this handler made the same targeted test pass:1 passed | 23 skipped.What you ruled out
CommandPalettehandler made the exact reproduction pass.origin/mainat8ac123f3551e7502a91c93e87329797f34ee626b.Suggested priority and effort
Medium priority, low effort. It affects IME users whenever Enter is used to confirm composition; switching input sources is a workaround. No data loss observed.
main.