Skip to content

Commit

Permalink
fix: losing focus while editing title field
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Trovic <luka@nextcloud.com>
  • Loading branch information
luka-nextcloud committed Jul 31, 2024
1 parent 5aca5b4 commit a364ca8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/board/Stack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
:placeholder="t('deck', 'Card name')"
required
pattern=".*\S+.*"
@focus="onCreateCardFocus"
@keydown.esc="stopCardCreation">
<input v-show="!stateCardCreating"
class="icon-confirm"
Expand Down Expand Up @@ -211,6 +212,13 @@ export default {
},
},
},
watch: {
showAddCard(newValue) {
if (!newValue) {
this.$store.dispatch('toggleShortcutLock', false)
}
},
},
methods: {
stopCardCreation(e) {
Expand Down Expand Up @@ -300,6 +308,9 @@ export default {
this.stateCardCreating = false
}
},
onCreateCardFocus() {
this.$store.dispatch('toggleShortcutLock', true)
},
},
}
</script>
Expand Down
4 changes: 4 additions & 0 deletions src/components/cards/CardItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
showArchived: state => state.showArchived,
currentBoard: state => state.currentBoard,
showCardCover: state => state.showCardCover,
shortcutLock: state => state.shortcutLock,
}),
...mapGetters([
'isArchived',
Expand Down Expand Up @@ -184,6 +185,9 @@ export default {
},
methods: {
focus(card) {
if (this.shortcutLock) {
return
}
card = this.$refs[`card${card}`]
card.focus()
},
Expand Down

0 comments on commit a364ca8

Please sign in to comment.