mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-20 10:11:58 +00:00
Follow-up to #37937. That fix guarded the composer's keyup with `shouldSkipTriggerRefreshOnKeyUp(key, trigger !== null)`. The `trigger !== null` check is timing-fragile for Escape: Escape's *keydown* sets `trigger = null` and closes the menu, but in a real browser the *keyup* fires after a re-render, so the handler closure sees `trigger === null`, the guard returns false, `refreshTrigger` runs, re-detects the still-present `/` in the input, and instantly reopens the menu. (jsdom batches state synchronously so a unit test could not observe this -- only the running app does.) Replace the value-based guard with a `triggerKeyConsumedRef` set synchronously in keydown whenever the open popover consumes a nav/control key (Arrow/Enter/Tab/Escape). keyup consults and clears that ref, so it is immune to the keydown->re-render->keyup timing. Applied to both the main composer (chat/composer/index.tsx) and the message-edit composer (assistant-ui/thread.tsx). Removes the now-unused `shouldSkipTriggerRefreshOnKeyUp` helper and its unit test. The real-DOM regression test now fires keydown+keyup pairs through the ref-based handlers and asserts Esc closes and stays closed. Verified by running a production renderer build (Vite v8) under Electron against a local backend: ArrowDown/ArrowUp cycle the full list and Esc dismisses the menu without reopening. |
||
|---|---|---|
| .. | ||
| hooks | ||
| attachments.tsx | ||
| completion-drawer.tsx | ||
| context-menu.tsx | ||
| controls.tsx | ||
| drop-affordance.ts | ||
| focus.ts | ||
| help-hint.tsx | ||
| index.tsx | ||
| inline-refs.ts | ||
| queue-panel.tsx | ||
| rich-editor.test.ts | ||
| rich-editor.ts | ||
| skin-slash-popover.tsx | ||
| slash-nav-dom-repro.test.tsx | ||
| text-utils.test.ts | ||
| text-utils.ts | ||
| trigger-popover.tsx | ||
| types.ts | ||
| url-dialog.tsx | ||
| voice-activity.tsx | ||