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(VNumberInput): disable keyboard up/down for readonly state #19906

Merged
merged 2 commits into from
May 28, 2024

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented May 27, 2024

Description

VNumberInput should keep original value as long as it has readonly, or disabled attributes or is contained within readonly form. (similar to other controls).

Fix is inspired by similar change for VAutocomplete and aims to render controls as disabled instead of just suppressing event handlers. Test cases should be self-explanatory.

Idea to consider: hiding controls and showing mdi-lock-outline instead would be a nice touch, but should probably follow internal discussion about consistency with other components accepting readonly prop.

fixes #19896

Playground:

<template>
  <v-app>
    <v-container>
      <v-card class="mx-auto pa-6 my-4" style="max-width: 1200px">
        <v-row>
          <v-col><v-switch color="success" hide-details v-model="inputDisabled" label="Disable input" /></v-col>
          <v-col><v-switch color="success" hide-details v-model="inputReadonly" label="Readonly input" /></v-col>
          <v-col><v-switch color="success" hide-details v-model="formReadonly" label="Readonly form" /></v-col>
        </v-row>

        <v-form :readonly="formReadonly">
          <v-number-input
            v-model="example"
            :readonly="inputReadonly"
            :disabled="inputDisabled"
          />
        </v-form>
      </v-card>
    </v-container>
  </v-app>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  const example = ref(50)
  const inputReadonly = ref(true)
  const inputDisabled = ref(false)
  const formReadonly = ref(false)
</script>

@yuwu9145 yuwu9145 self-requested a review May 27, 2024 11:55
@yuwu9145 yuwu9145 added T: bug Functionality that does not work as intended/expected C: VNumberInput labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VNumberInput 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.6.7] fix(VNumberInput): disable keyboard up/down for readonly state
2 participants