Skip to content

fix(VSelect): match autofill against item values - #23063

Open
pupuking723 wants to merge 1 commit into
vuetifyjs:masterfrom
pupuking723:fix/select-autofill-item-values
Open

fix(VSelect): match autofill against item values#23063
pupuking723 wants to merge 1 commit into
vuetifyjs:masterfrom
pupuking723:fix/select-autofill-item-values

Conversation

@pupuking723

Copy link
Copy Markdown

Description

Fixes #20560.

Browser address autofill commonly writes short state or country codes such as CA or US. VSelect and VAutocomplete previously compared autofilled text only with each item's title, so those values were ignored when the visible labels were California or United States.

This keeps the existing title matching behavior and also checks the item value in the autofill-only paths. Focused browser tests cover both components.

Verification:

  • pnpm --filter vuetify test:browser --run src/components/VSelect/__tests__/VSelect.spec.browser.tsx src/components/VAutocomplete/__tests__/VAutocomplete.spec.browser.tsx (90 passed)
  • pnpm --filter vuetify lint
  • git diff --check

Markup:

<script setup>
const states = [
  { title: 'California', value: 'CA' },
  { title: 'New York', value: 'NY' },
]

const countries = [
  { title: 'United States', value: 'US' },
  { title: 'Canada', value: 'CA' },
]
</script>

<template>
  <v-container>
    <v-form autocomplete="on">
      <v-text-field
        autocomplete="name"
        label="Name"
        name="name"
      />

      <v-select
        autocomplete="address-level1"
        :items="states"
        label="State"
        name="state"
      />

      <v-autocomplete
        autocomplete="country"
        :items="countries"
        label="Country"
        name="country"
      />
    </v-form>
  </v-container>
</template>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.2] Browser address autofill not populating states or countries

1 participant