Skip to content

Commit

Permalink
Merge pull request #6140 from nextcloud/fix/losing-focus
Browse files Browse the repository at this point in the history
fix: losing focus while editing title field
  • Loading branch information
juliushaertl committed Aug 1, 2024
2 parents 5aca5b4 + 2e552f4 commit 2630b6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import './commands.js'

Cypress.on('uncaught:exception', (err) => {
return !err.message.includes('ResizeObserver loop limit exceeded')
return !err.message.includes('ResizeObserver loop limit exceeded') && !err.message.includes('ResizeObserver loop completed with undelivered notifications')
})

// Alternatively you can use CommonJS syntax:
Expand Down
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 2630b6c

Please sign in to comment.