Confirm a composed character with Enter on the desktop question box, instead of sending the question - #507
Closed
kevin9327 wants to merge 1 commit into
Closed
Conversation
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 12, 2026 22:03
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
kevin9327
force-pushed
the
fix/desktop-ask-ime-enter
branch
from
September 12, 2026 22:06
cd65aca to
a6bcc4a
Compare
…instead of sending the question Japanese, Chinese and Korean are typed through an input method, where Enter confirms the character being built. The last setup screen's question box read that Enter as a plain Enter and sent the question with its last character still unconfirmed. The box now ignores a keydown that belongs to a composition, using the guard MDN documents for it: isComposing, or key code 229 for WebKit, which fires the confirming keydown after compositionend. This matches the chat composer, whose Enter already skips it. An ordinary Enter still asks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kevin9327
force-pushed
the
fix/desktop-ask-ime-enter
branch
from
September 12, 2026 22:08
a6bcc4a to
907d403
Compare
Contributor
|
Thanks, and the IME-composition bug is a real one. Closing it, though, because it is in the desktop app ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happens
On the desktop app's last setup screen, "Ask it something", type the question in Japanese, Chinese or Korean. Those languages are typed through an input method (IME): letters build a character, and Enter confirms it.
That Enter also sends the question. It goes to the Bot with its last character still unconfirmed, and the screen shows an answer to a question nobody finished typing. The chat composer inside OpenBot does not do this. This box does.
Why
desktop/src/Ask.tsx:The Enter that confirms a composed character is still a
keydownwithkey === "Enter". Browsers mark it in one of two ways, depending on engine:isComposing: trueon it;compositionend, soisComposingis alreadyfalse, but itskeyCodeis229. WebKit is the desktop app's webview on macOS.MDN's
keydowndocumentation gives exactly this guard for ignoring keydowns that belong to a composition:event.isComposing || event.keyCode === 229.The chat composer's own Enter already skips it.
prompt-area, which draws it, checks!event.nativeEvent.isComposingon every Enter branch, so this box was the one that did not.The change
The same condition, plus the 229 half for WebKit:
An ordinary Enter still asks, and the Ask button is untouched.
Where it runs
Boundary and audit
Untouched. This screen calls
ask_the_bot; nothing on the gateway path changes.Changelog
A line under
Unreleased, since the setup screen behaves differently for anyone typing through an input method.Proof
Two tests in
desktop/src/App.test.tsx, which already drives setup through to this screen. They share a smallreachAsk()helper built on the existinguseCompatibleEndpointSetupandenterCompatibleEndpoint.the Enter that finishes a composed character does not ask the Botfires both shapes above at the focused question box and expects noask_the_bot.an ordinary Enter in the question box asks the Bot, onceis the pin.bun test src/App.test.tsx -t "composed character|ordinary Enter", withAsk.tsxas it is onmain(absolute paths shortened to the repository root, nothing else edited):Both confirming Enters sent the question. With the change: 2 pass, 0 fail.
Not a widening. The pin,
an ordinary Enter in the question box asks the Bot, once, is the1 passabove: it passes before and after. The only presses this changes are the two that belong to a composition.Whole desktop suite (
bun testindesktop/):maindesktopThe delta is the two tests added.
bun run typecheckindesktop/exits 0.bunx @biomejs/biome checkandbunx prettier --checkare clean onAsk.tsxandApp.test.tsx.prettier --check CHANGELOG.mdreports style issues, but it does onmaintoo: every suggestion is a missing blank line further down the file, none in the lines added here.What was and was not measured: the handler's response to the two event shapes, above. I could not drive a live input method in a webview on this machine, so the claim about which shape each engine sends rests on MDN's documented guard rather than on a recording.
One harness detail: the test clicks into the field before pressing keys. Under happy-dom, React handles a
keydownon an input through its input-event polyfill, which tracks the focused element, so a keydown on an input nobody focused throws inside React rather than reaching the handler. Clicking in first is also how a person reaches the box.Note: the same shape in the web app
Three inputs in
app/act on a bareevent.key === "Enter"as well:components/agents/agent-dialog.tsx(editing a coworker's name and similar);components/agents/create-agent-dialog.tsx;routes/_authed/admin/boundaries.tsx.I left them out rather than fold a second package into this change. None of those components has a test that renders it yet, and each would need its own query and fetch setup. Happy to send them separately if you would like the same guard there.
Note on the CHANGELOG
The entry goes at the top of
## Unreleased, the one line every entry goes at, so it will conflict with #506 and any other PR open against that anchor. Happy to rebase whenever it suits you.🤖 Generated with Claude Code