From 07cdd4867a5aef805be3d5a4155379c201af365f Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 13 Mar 2026 17:30:17 +0100 Subject: [PATCH] Fix custom combatant form disappearing when dismissing suggestions The "Add as custom" button and Escape key were clearing the name input along with the suggestions, preventing the custom fields (Init, AC, MaxHP) from ever appearing. Now only the suggestions are dismissed, keeping the typed name intact so the custom combatant form renders. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/components/action-bar.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/action-bar.tsx b/apps/web/src/components/action-bar.tsx index 94f3b9a..631491f 100644 --- a/apps/web/src/components/action-bar.tsx +++ b/apps/web/src/components/action-bar.tsx @@ -284,6 +284,13 @@ export function ActionBar({ setSuggestionIndex(-1); }; + const dismissSuggestions = () => { + setSuggestions([]); + setPcMatches([]); + setQueued(null); + setSuggestionIndex(-1); + }; + const confirmQueued = () => { if (!queued) return; for (let i = 0; i < queued.count; i++) { @@ -395,7 +402,7 @@ export function ActionBar({ e.preventDefault(); handleEnter(); } else if (e.key === "Escape") { - clearInput(); + dismissSuggestions(); } }; @@ -514,7 +521,7 @@ export function ActionBar({ pcMatches={pcMatches} suggestionIndex={suggestionIndex} queued={queued} - onDismiss={clearInput} + onDismiss={dismissSuggestions} onClickSuggestion={handleClickSuggestion} onSetSuggestionIndex={setSuggestionIndex} onSetQueued={setQueued}