Skip to content

Conversation

@jcjp
Copy link
Contributor

@jcjp jcjp commented Apr 18, 2025

Description


  • On file drop on VFileInput component the internal input element files value is unpopulated or not updated
  • The issue is also observed on clear, the files value remains even if clear button was clicked and file was removed
  • Minor refactor and code cleanup

Markup:

<template>
  <v-app>
    <v-container>
      <v-file-input
        v-model="file"
        ref="fileInput"
        @update:model-value="updateFileList"
      />
      <pre>
Number of files in internal &lt;input&gt; tag = {{ inputFieldFiles }}</pre
      >
    </v-container>
  </v-app>
</template>

<script setup>
import { ref, computed, watch, nextTick } from 'vue'

const file = ref()
const fileInput = ref()

const inputFieldFiles = ref(0)
function updateFileList() {
  inputFieldFiles.value = fileInput.value.files.length
}
</script>

@jcjp jcjp marked this pull request as ready for review April 18, 2025 16:22
@jcjp jcjp requested review from KaelWD and johnleider April 18, 2025 16:22
@jcjp jcjp self-assigned this Apr 18, 2025
@jcjp jcjp added C: VFileInput T: bug Functionality that does not work as intended/expected labels Apr 18, 2025
@jcjp jcjp requested review from Arslan038, Spatlani and ikushum April 25, 2025 13:06
jcjp added 2 commits April 25, 2025 21:54
fix(VFileInput): on clear internal input not updated
refactor(VFileInput): move on change to a function
refactor(VFileInput): remove some codes
@jcjp jcjp force-pushed the fix(VFileInput)/on-drop-internal-input-unpopulated branch from 820dc0d to 42e9d9f Compare April 25, 2025 13:54
@jcjp jcjp removed the request for review from Arslan038 May 3, 2025 12:21
@johnleider
Copy link
Member

#21248 actually ended up being fixed by #21182, more specifically dfaece7

@johnleider johnleider closed this May 13, 2025
@jcjp jcjp deleted the fix(VFileInput)/on-drop-internal-input-unpopulated branch September 6, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: VFileInput 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.8.1] VFileInput - Underlying <input> not populated when file is dragged into component

2 participants