Repository navigation
fix(input): prevent navigation keys from leaking into editable text - #3389
Merged
Merged
Conversation
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.
Summary
Prevent navigation/function-key payloads from becoming invisible text in FlowChat and other form fields. Install a shared native input guard in the desktop/web UI, mobile web, and installer; retain normal navigation, IME composition, selections, and meaningful Unicode such as joined emoji.
Type and Areas
Type: Bug fix.
Areas: Shared browser input handling, FlowChat, mobile web, installer.
Motivation / Impact
FlowChat omitted AppKit function-key characters from its sanitizer and relied on
inputTypefrom React 18's synthesizedonBeforeInput, which does not reliably expose the native event. Ordinary fields had no equivalent protection.The native capture guard cancels pure control-character insertions before editing and repairs mixed or non-cancellable input before field handlers consume it. FlowChat also sanitizes pasted content before handing it to the large-paste owner, preserves Unicode joiners, and no longer treats key-control payloads as printable keys for autofocus. Model-owned editor and terminal buffers remain exempt from DOM repair.
Verification
pnpm --dir src/web-ui exec vitest run --maxWorkers=50% src/shared/utils/textInputGuard.test.tsx src/flow_chat/components/RichTextInput.test.tsx src/flow_chat/hooks/useComposerDefaultFocus.test.tsx src/flow_chat/utils/chatInputKeyOwnership.test.tspnpm --dir src/web-ui exec tsc --noEmit,pnpm --dir src/mobile-web run type-check,pnpm --dir OpenBitFun-Installer run type-check.pnpm run appearance:contract-audit,pnpm run theme:color-audit:test,pnpm run theme:color-audit:all,pnpm run theme:visual-contract, andgit diff --check.pnpm run check:webis blocked by 25 pre-existing typography audit violations in unchanged Design Lab/mobile component styles. Its remaining relevant checks were run separately as listed above.Reviewer Notes
AI-assisted implementation; automated DOM and type coverage completed. Native OS keyboard reproduction and remote-workspace, remote-control, Peer Device, and Detached Dispatch integration were not exercised. This changes frontend input handling only; persisted shapes and transport protocols are unchanged. No visual layout changes.
Checklist