Skip to content
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

fix(VListItem): dont trigger kb events for disabled item #15339

Conversation

lampdev
Copy link
Contributor

@lampdev lampdev commented Jun 24, 2022

Description

Add check for disabled prop to keydown handler

Motivation and Context

Fixes #15322

How Has This Been Tested?

unit and visually

Markup:

<template>
  <v-container>
    <p class="pa-6 text-center">The second item should not emit the click event when focussed using keyboard and pressing enter:</p>
    <v-card class="mx-auto" max-width="400" tile>
      <v-list-item tabindex="0" @click="ClickMe()">
        <v-list-item-content>
          <v-list-item-title>Single-line item</v-list-item-title>
        </v-list-item-content>
      </v-list-item>

      <v-list-item disabled tabindex="0" two-line @click="ClickMe()">
        <v-list-item-content>
          <v-list-item-title>Two-line item</v-list-item-title>
          <v-list-item-subtitle>Secondary text</v-list-item-subtitle>
        </v-list-item-content>
      </v-list-item>

      <v-list-item tabindex="0" three-line>
        <v-list-item-content>
          <v-list-item-title>Three-line item</v-list-item-title>
          <v-list-item-subtitle>
            Secondary line text Lorem ipsum dolor sit amet,
          </v-list-item-subtitle>
          <v-list-item-subtitle>
            consectetur adipiscing elit.
          </v-list-item-subtitle>
        </v-list-item-content>
      </v-list-item>
    </v-card>
  </v-container>
</template>

<script>
  export default {
    data: () => ({
    //
    }),
    methods: {
      ClickMe() {
        alert("Clicked");
      }
    }
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

@KaelWD KaelWD merged commit 817df79 into vuetifyjs:master Jun 29, 2022
@KaelWD KaelWD added this to the v2.6.x milestone Aug 5, 2022
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][2.6.6] v-list-tile emits click when disabled
2 participants