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(VField, VInput): emit click:* events using keyboard #20878

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Jan 17, 2025

Description

fixes #20864

Markup:

<template>
  <v-app>
    <v-container>
      <v-row justify="center">
        <v-col cols="12" sm="8">
          <v-alert class="mb-4" type="info" text="Focus each icon and use keyboard [Space] and [Enter]" />
          <v-text-field
            v-model="password"
            :append-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
            :append-inner-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
            :prepend-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
            :prepend-inner-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
            :type="show ? 'text' : 'password'"
            hint="At least 8 characters"
            label="Password"
            persistent-hint
            clearable
            @click:append="show = !show"
            @click:appendInner="show = !show"
            @click:prepend="show = !show"
            @click:prependInner="show = !show"
          />
        </v-col>
        <v-col cols="12" sm="8">
          <v-combobox
            v-model="comboChips"
            append-icon="$plus"
            append-inner-icon="$plus"
            prepend-icon="$plus"
            prepend-inner-icon="$plus"
            chips multiple clearable
            @click:append="comboChips.push('append')"
            @click:appendInner="comboChips.push('appendInner')"
            @click:prepend="comboChips.push('prepend')"
            @click:prependInner="comboChips.push('prependInner')"
          />
        </v-col>
        <v-col cols="12" sm="8">
          <v-textarea
            v-model="clicksLog"
            append-icon="mdi-cow"
            append-inner-icon="mdi-cow"
            prepend-icon="mdi-cow"
            prepend-inner-icon="mdi-cow"
            auto-grow clearable
            @click:append="clicksLog += '\nappend'"
            @click:appendInner="clicksLog += '\nappendInner'"
            @click:prepend="clicksLog += '\nprepend'"
            @click:prependInner="clicksLog += '\nprependInner'"
          />
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

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

  const show = ref(false)
  const password = ref('Password')
  const clicksLog = ref('')
  const comboChips = ref([])
</script>

@J-Sek J-Sek self-assigned this Jan 17, 2025
@J-Sek J-Sek added a11y Accessibility issue C: VInput C: VField labels Jan 17, 2025
@KaelWD
Copy link
Member

KaelWD commented Jan 20, 2025

Any thoughts on 26ce6ec?

@J-Sek
Copy link
Contributor Author

J-Sek commented Jan 20, 2025

Any thoughts on 26ce6ec?

There is an issue when I use [space] on *-inner icons – the field is being immediately focused. It might feel a bit surprising depending on the scenario.

We could resolve this by stopping propagation in InputIcon.tsx

@J-Sek J-Sek requested a review from KaelWD January 20, 2025 11:35
@KaelWD KaelWD merged commit 5ca8184 into vuetifyjs:master Jan 21, 2025
10 checks passed
@J-Sek J-Sek deleted the fix/20864-append-click branch January 21, 2025 09:39
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.6] v-text-field append-icon click handler does not support keyboard input
2 participants