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(VSelect): cannot select items with value '0' with keyboard #15298

Conversation

ERPedersen
Copy link
Contributor

fix(VSelect): items with value 0 not included in counter

Description

In the onKeyPress method and computedCounterValue computed function, the extracted text from the list item is falling back to en empty string if the value is falsy. I've changed the code, so it must be either truthy or zero.

Motivation and Context

fixes #15166

How Has This Been Tested?

visually

Markup:

Reproduction steps:

  1. Click the <VSelect>.
  2. Press 0 on the keyboard.
  3. Evaluate that the first element is selected.
  4. Evaluate that the counter is set to 1 when the first element is selected.
<template>
  <v-container>
    <v-select
      v-model="value"
      :items="items"
      counter
    />
    {{ value }}
  </v-container>
</template>

<script>
  export default {
    data () {
      return {
        value: null,
        items: [
          0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
        ],
      }
    },
  }
</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)

fix(VSelect): items with value 0 not included in counter
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.2] v-select not taking input value 0 from keyboard
2 participants