A full-featured CRM built with React, shadcn/ui, and Supabase.
ensure the choice list is not scrolled down while filtering
ThieryMichelc25e2eb8ec90
diff --git a/src/components/admin/autocomplete-input.tsx b/src/components/admin/autocomplete-input.tsxindex 4705fb12..b2d7243d 100644--- a/src/components/admin/autocomplete-input.tsx+++ b/src/components/admin/autocomplete-input.tsx@@ -125,6 +125,7 @@ export const AutocompleteInput = (});const [filterValue, setFilterValue] = React.useState("");+ const listRef = React.useRef<HTMLDivElement>(null);const [open, setOpen] = React.useState(false);const selectedChoice = allChoices.find(@@ -243,6 +244,7 @@ export const AutocompleteInput = (value={filterValue}onValueChange={(filter) => {setFilterValue(filter);+ listRef.current?.scrollTo(0, 0);// We don't want the ChoicesContext to filter the choices if the input// is not from a reference as it would also filter out the selected valuesif (isFromReference) {@@ -250,7 +252,7 @@ export const AutocompleteInput = (}}}/>- <CommandList>+ <CommandList ref={listRef}><CommandEmpty>No matching item found.</CommandEmpty><CommandGroup>{finalChoices.map((choice) => {