From 58b57d3492af80ee52739624afa7ee60b13a05bf Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 30 Sep 2025 16:21:56 -0600 Subject: [PATCH] interaction behavior --- .../input/BusterChatInput/BusterChatInputBase.tsx | 1 + .../MentionInputSuggestions.tsx | 13 +++++++++++-- .../MentionInputSuggestions.types.ts | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx b/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx index f43d90f13..dc67590c0 100644 --- a/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx +++ b/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx @@ -132,6 +132,7 @@ export const BusterChatInputBase: React.FC = React.memo( ref={mentionInputSuggestionsRef} inputContainerClassName="px-5 pt-4" inputClassName="text-md" + behavior="open-on-focus" > { const [hasClickedSelect, setHasClickedSelect] = useState(false); + const [hasInteracted, setHasInteracted] = useState(behavior === 'default'); const [value, setValue] = useState(valueProp ?? defaultValue); const commandListNavigatedRef = useRef(false); const commandRef = useRef(null); const mentionsInputRef = useRef(null); - const showSuggestionList = !hasClickedSelect && suggestionItems.length > 0; + const showSuggestionList = + behavior === 'default' + ? !hasClickedSelect && suggestionItems.length > 0 + : hasInteracted && suggestionItems.length > 0; const onChangeInputValue: MentionInputProps['onChange'] = useCallback( (d) => { @@ -68,8 +73,9 @@ export const MentionInputSuggestions = forwardRef< onChange?.(d); commandListNavigatedRef.current = false; setHasClickedSelect(false); + setHasInteracted(true); }, - [onChange, setHasClickedSelect] + [onChange, setHasClickedSelect, setHasInteracted] ); //Exported: this is used to change the value of the input from outside the component @@ -183,6 +189,9 @@ export const MentionInputSuggestions = forwardRef< )} shouldFilter={shouldFilter} filter={filter || customFilter} + onClick={() => { + setHasInteracted(true); + }} > = { inputContainerClassName?: string; suggestionsContainerClassName?: string; inputClassName?: string; + behavior?: 'default' | 'open-on-focus'; } & Pick, 'filter' | 'shouldFilter'>; export type MentionInputSuggestionsRef = {