Skip to content

Commit

Permalink
fix: use empty template by default when pressing enter
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
  • Loading branch information
elzody authored and AndyScherzinger committed Aug 29, 2024
1 parent f81a349 commit 1d9066c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/files/src/components/TemplatePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<template>
<li class="template-picker__item">
<input :id="id"
ref="input"
:checked="checked"
type="radio"
class="radio"
Expand Down Expand Up @@ -124,6 +125,9 @@ export default {
onFailure() {
this.failedPreview = true
},
focus() {
this.$refs.input?.focus()
},
},
}
</script>
Expand Down
6 changes: 6 additions & 0 deletions apps/files/src/views/TemplatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<!-- Templates list -->
<ul class="templates-picker__list">
<TemplatePreview v-bind="emptyTemplate"
ref="emptyTemplatePreview"
:checked="checked === emptyTemplate.fileid"
@check="onCheck" />

Expand Down Expand Up @@ -179,6 +180,11 @@ export default defineComponent({
// Else, open the picker
this.opened = true
// Set initial focus to the empty template preview
this.$nextTick(() => {
this.$refs.emptyTemplatePreview?.focus()
})
},
/**
Expand Down

0 comments on commit 1d9066c

Please sign in to comment.