Move DOM event handling out of useEntitySearchInput into its component - #697
Merged
Merged
Conversation
This was referenced Aug 5, 2026
gaidheal1
force-pushed
the
claude/issue-573-implementation-wrgq0t
branch
from
August 9, 2026 13:53
47edbce to
505ea15
Compare
gaidheal1
marked this pull request as ready for review
August 9, 2026 14:13
gaidheal1
force-pushed
the
claude/issue-573-implementation-wrgq0t
branch
from
August 9, 2026 14:13
505ea15 to
aec2148
Compare
gaidheal1
force-pushed
the
claude/issue-573-implementation-wrgq0t
branch
from
August 9, 2026 14:33
aec2148 to
27fd993
Compare
useEntitySearchInput reached into the DOM directly for click-outside dismissal and typed its keydown handler against KeyboardEvent<HTMLInputElement>. This splits it along the platform boundary, per #573: - Hook now exposes intent-shaped actions (onSelectNext, onSelectPrevious, onDismiss, onCommit) instead of a DOM-typed handleKeyDown. - The document mousedown listener for click-outside dismissal moves to EntitySearchInput.tsx, which owns the rootRef and translates the gesture into onDismiss(). - EntitySearchInput.tsx's handleKeyDown translates raw KeyboardEvents into the hook's semantic actions. - window.setTimeout/window.clearTimeout -> bare setTimeout/clearTimeout. Fixes #573
gaidheal1
force-pushed
the
claude/issue-573-implementation-wrgq0t
branch
from
August 9, 2026 14:41
27fd993 to
aaf264e
Compare
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
useEntitySearchInputwas named and positioned as a logic hook, but it reached into the DOM directly for click-outside dismissal and typed its keydown handler against DOM element interfaces. This splits it along the platform boundary, per #573.fuse.js, result derivation, selection state, the debounce, and the semantic intent of keyboard actions — now exposed asonSelectNext,onSelectPrevious,onDismiss,onCommitinstead of a DOM-typedhandleKeyDown.onCommitreturns whether it took action, so the caller knows whether to suppress the key's default behaviour.EntitySearchInput.tsx(web): thedocumentmousedown listener for click-outside dismissal (component now ownsrootRefand callsonDismiss()), and translation of rawKeyboardEvents into the hook's semantic actions.window.setTimeout/window.clearTimeout→ baresetTimeout/clearTimeout.This branch is stacked on #680 (extracting the
beforeunloadguard out ofuseActivityTimer), since both are part of the #569 DOM-decoupling epic and this one was started from that branch.Acceptance criteria
documentorwindowreference remains inuseEntitySearchInput.tsHTMLInputElement,KeyboardEvent) in the hook's public surfaceEntitySearchInput.test.tsxstill passesTest plan
npx tsc --noEmit— no errorsnpx eslint src/components/EntitySearchInput/— no errorsnpx vitest run— 410/410 pass (pre-existing Playwright browser-launch error is unrelated to this change)Fixes #573
Generated by Claude Code