From c5935fbdf5ff689fde484e83c04ad87e4ba390d1 Mon Sep 17 00:00:00 2001 From: Gabriel Horacio Cutrini Date: Fri, 15 May 2026 20:19:30 -0300 Subject: [PATCH] fix(company-input-v2): commit typed/autofilled value on blur MUI Autocomplete in freeSolo mode only fires onChange when the user explicitly selects an option, so values entered via typing-and-tabbing or browser autofill (notably iOS Chrome) never propagate to the parent and required-field validation fails on submit. - Enable Autocomplete autoSelect so the current input value is committed on blur, matching MUI's intended pattern for free-text combos. - Normalize string values inside onChange to the {id, name} shape that consumers expect, since autoSelect emits the raw typed string. --- src/components/inputs/company-input-v2.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/inputs/company-input-v2.js b/src/components/inputs/company-input-v2.js index 2767592..e99338c 100644 --- a/src/components/inputs/company-input-v2.js +++ b/src/components/inputs/company-input-v2.js @@ -56,6 +56,7 @@ const CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, v name={name} options={options} autoComplete + autoSelect freeSolo includeInputInList filterSelectedOptions @@ -82,6 +83,10 @@ const CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, v name: newValue.inputValue }; } + // autoSelect commits the raw typed/autofilled string on blur; normalize to {id, name}. + if (typeof tmpValue === "string" && tmpValue.trim()) { + tmpValue = { id: 0, name: tmpValue.trim() }; + } setOptions(tmpValue ? [tmpValue, ...options] : options); let ev = { target: {