Skip to content

fix(VList): Use proper accessibility attributes #21444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ikushum
Copy link
Member

@ikushum ikushum commented May 20, 2025

fixes #20978

Description

Use proper accessibility attributes for VList and VListItem

Markup:

<template>
  <v-card>
    <!-- With items prop -->
    <v-list
      :items="items"
      item-title="name"
      aria-label="Nice list"
    ></v-list>

    <v-divider />

    <!-- With v-list-item -->
    <v-list selectable aria-label="Nice list">
      <v-list-item
        v-for="item in items"
        :key="item.id"
        :value="item.id"
      >
        {{ item.name }}
      </v-list-item>
    </v-list>

    <v-divider />

    <!-- With v-list-item and no parent v-list -->
    <v-list-item>
      VListItem
    </v-list-item>
  </v-card>
</template>

<script>
  export default {
    data: () => ({
      items: [
        {
          name: 'Item #1',
          id: 1,
        },
        {
          name: 'Item #2',
          id: 2,
        },
        {
          name: 'Item #3',
          id: 3,
        },
      ],
    }),
  }
</script>

@ikushum ikushum force-pushed the fix/v-list-accessibility branch from 7bcbdc3 to 139eada Compare May 20, 2025 18:53
@ikushum ikushum marked this pull request as draft May 20, 2025 18:58
@ikushum ikushum self-assigned this May 20, 2025
@ikushum ikushum added a11y Accessibility issue C: VList C: VListItem labels May 20, 2025
@ikushum ikushum marked this pull request as ready for review May 20, 2025 19:34
@ikushum
Copy link
Member Author

ikushum commented May 20, 2025

⚠️ Not sure if this can be counted as a breaking change because v-list will now have list role by default instead of "listbox".

@ikushum ikushum requested a review from johnleider May 20, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.12] V-List-Items within v-list should not have property "aria-selected"
1 participant