Skip to content

Commit

Permalink
Merge pull request #4541 from nextcloud/bugfix/4536/autofocus-upload-…
Browse files Browse the repository at this point in the history
…dialog-submit

Focus on submit button by default in upload dialog
  • Loading branch information
PVince81 authored Nov 6, 2020
2 parents a740b4e + 9f07b4c commit 36617f6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/UploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<button @click="handleDismiss">
{{ t('spreed', 'Dismiss') }}
</button>
<button class="primary" @click="handleUpload">
<button ref="submitButton" class="primary" @click="handleUpload">
{{ t('spreed', 'Send') }}
</button>
</div>
Expand Down Expand Up @@ -115,12 +115,24 @@ export default {
},

watch: {
showModal(show) {
if (show) {
this.focus()
}
},

currentUploadId() {
this.modalDismissed = false
},
},

methods: {
focus() {
this.$nextTick(() => {
this.$refs.submitButton.focus()
})
},

handleDismiss() {
this.modalDismissed = true
},
Expand Down

0 comments on commit 36617f6

Please sign in to comment.