From 0d1709aa7c007227c2ba957c743c0a5b9e182067 Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Thu, 14 May 2026 15:27:56 -0700 Subject: [PATCH 1/7] fix combobox editing issue --- app/components/form/fields/ComboboxField.tsx | 6 ++ app/ui/lib/Combobox.tsx | 2 +- app/ui/lib/FileInput.tsx | 4 +- test/e2e/instance-create.e2e.ts | 80 ++++++++++++++++++-- 4 files changed, 82 insertions(+), 10 deletions(-) diff --git a/app/components/form/fields/ComboboxField.tsx b/app/components/form/fields/ComboboxField.tsx index efa0558293..ce122b7484 100644 --- a/app/components/form/fields/ComboboxField.tsx +++ b/app/components/form/fields/ComboboxField.tsx @@ -45,6 +45,7 @@ export function ComboboxField< label = capitalize(name), required, onChange, + onInputChange, allowArbitraryValues, placeholder, // Intent is to not show both a placeholder and a description, while still having good defaults; prefer a description to a placeholder @@ -88,6 +89,11 @@ export function ComboboxField< onChange?.(value) setSelectedItemLabel(getSelectedLabelFromValue(items, value)) }} + onInputChange={(value) => { + // If the user edits the input field, if arbitrary values are allowed, set the field's value; otherwise, clear the selected value + field.onChange(allowArbitraryValues ? value : undefined) + onInputChange?.(value) + }} allowArbitraryValues={allowArbitraryValues} inputRef={field.ref} transform={transform} diff --git a/app/ui/lib/Combobox.tsx b/app/ui/lib/Combobox.tsx index 0abe2b54c8..b8b41b31fa 100644 --- a/app/ui/lib/Combobox.tsx +++ b/app/ui/lib/Combobox.tsx @@ -281,7 +281,7 @@ export const Combobox = ({ // of those rules one by one. Better to rely on the shared classes.
diff --git a/app/ui/lib/FileInput.tsx b/app/ui/lib/FileInput.tsx index 3728a1d8ed..f099c057d6 100644 --- a/app/ui/lib/FileInput.tsx +++ b/app/ui/lib/FileInput.tsx @@ -36,6 +36,7 @@ export function FileInput({ onChange, error, ref, + id, ...inputProps }: FileInputProps) { const inputRef = useRef(null) @@ -63,8 +64,9 @@ export function FileInput({ } return ( -