fix(VAutocomplete): use hidden select for native form submissions#22757
Open
faizkhairi wants to merge 1 commit intovuetifyjs:masterfrom
Open
fix(VAutocomplete): use hidden select for native form submissions#22757faizkhairi wants to merge 1 commit intovuetifyjs:masterfrom
faizkhairi wants to merge 1 commit intovuetifyjs:masterfrom
Conversation
Apply the same fix pattern from VSelect (vuetifyjs#22330) to VAutocomplete. The visible text input now passes name=undefined to avoid submitting an empty string. A hidden <select> driven by the model carries the actual selected value(s) through native form submission. Fixes vuetifyjs#22270
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Apply the same fix pattern from VSelect (#22330) to VAutocomplete. When using
v-modelor:model-value, the component's input value was empty until user interaction, breaking native form submission and Cypress tests.Root Cause
VAutocomplete uses a real
<input>for its search field, but the input's value is only populated when the component is focused (isFocusedwatcher setssearch.value). This means native form submission always submits an empty string.Fix
Mirror the VSelect fix from #22330:
useAutocomplete(props)— reuses the existing composable created in fix(VSelect): Use hidden select for native form submissions #22330name={undefined}to<VTextField>— excludes the visible text input from form submission<select>with<option>elements driven byitemsandselectedValues— this is what native form submission readsTests Added
FormDatacontains the selected valueFormDatacontains all selected valuesRelated
AI Disclosure
This contribution used AI assistance (Claude Code) for codebase exploration and implementation.