emma-hermes/apps/desktop/src
kshitijk4poor 49f1b9e4b4 fix(desktop): stop Esc reopening the slash/@ menu; harden keyup guard
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.
2026-06-03 13:15:08 +05:30
..
app fix(desktop): stop Esc reopening the slash/@ menu; harden keyup guard 2026-06-03 13:15:08 +05:30
components fix(desktop): stop Esc reopening the slash/@ menu; harden keyup guard 2026-06-03 13:15:08 +05:30
hooks Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
lib feat(desktop): inline model picker in the status bar 2026-06-02 19:09:41 -05:00
store fix(desktop): make Stop button actually interrupt when a turn is queued 2026-06-03 11:46:02 +05:30
themes Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
types Merge pull request #37738 from NousResearch/bb/statusbar-model-menu 2026-06-02 20:00:39 -05:00
global.d.ts fix(desktop): triage batch of GUI quality-of-life fixes (#37536) 2026-06-02 16:33:22 -04:00
hermes.ts fix(desktop): keep pinned + recent sessions visible across compression 2026-06-02 07:12:05 -05:00
main.tsx fix(desktop): stabilize project folder sessions (#37586) 2026-06-02 20:23:09 +00:00
styles.css chore: uptick 2026-06-02 23:44:51 -05:00
vite-env.d.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00