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(VFileInput): label click opens dialog twice #15902

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/vuetify/src/components/VFileInput/VFileInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default VTextField.extend({

// This solves an issue in Safari where
// nothing happens when adding a file
// do to the input event not firing
// due to the input event not firing
// https://github.com/vuetifyjs/vuetify/issues/7941
delete input.data!.on!.input
input.data!.on!.change = this.onInput
Expand Down Expand Up @@ -259,7 +259,12 @@ export default VTextField.extend({

node.data!.on = {
...(node.data!.on || {}),
click: () => this.$refs.input.click(),
click: (e: MouseEvent) => {
// Clicking the label already delegates to input element, so we shouldn't click it twice
if (e.target && (e.target as HTMLElement).nodeName === 'LABEL') return

this.$refs.input.click()
},
}

return node
Expand Down