Skip to content

Conversation

@ikushum
Copy link
Member

@ikushum ikushum commented Nov 15, 2025

fixes #21097

Description

This PR ensures

  1. Screen readers read out selected item title instead of value
  2. When performing native form submissions, the form data uses item value instead of title.

This is achieved by used a hidden <select and visible <input. The user and screen-readers interact with the visible <input. But when making native form submissions, the form data uses the hidden <select because it will contain the name attribute

Markup:

<template>
  <v-app>
    <v-container>
      <v-form ref="form">
        <v-select :items="selectItems" autocomplete="suppress" name="select" />

        <v-btn class="my-5" @click="refreshFormData()">Refresh form data</v-btn>
      </v-form>
      <pre>{{ formData }}</pre>
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'

  const form = ref()
  const formData = ref('')

  const selectItems = [
    { title: 'Item 1', value: 1 },
    { title: 'Item 2', value: 2 },
    { title: 'Item 3', value: 3 },
  ]

  function refreshFormData () {
    const fd = new FormData(form.value.$el)
    formData.value = JSON.stringify(fd.entries().toArray())
  }
</script>

@ikushum ikushum self-assigned this Nov 15, 2025
@ikushum ikushum added a11y Accessibility issue C: VSelect T: bug Functionality that does not work as intended/expected labels Nov 15, 2025
@ikushum ikushum marked this pull request as ready for review November 15, 2025 08:58
@ikushum ikushum requested a review from a team November 15, 2025 08:58
@ikushum
Copy link
Member Author

ikushum commented Nov 15, 2025

Related PR that targets this - #22331

@ikushum ikushum force-pushed the fix/select-accessibility branch 2 times, most recently from 2e2fe59 to e86ff56 Compare November 15, 2025 09:09
@ikushum ikushum force-pushed the fix/select-accessibility branch from e86ff56 to 2564dbe Compare November 15, 2025 09:10
@ikushum ikushum force-pushed the fix/select-accessibility branch from 2d46e21 to b3abbf0 Compare November 15, 2025 17:43
@ikushum ikushum merged commit 3966739 into master Nov 16, 2025
18 checks passed
@ikushum ikushum deleted the fix/select-accessibility branch November 16, 2025 00:19
@ikushum ikushum changed the title fix(VSelect): Use hidden input for native form submissions fix(VSelect): Use hidden select for native form submissions Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility issue C: VSelect T: bug Functionality that does not work as intended/expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.16] v-autocomplete, v-select accessibility problem,

3 participants