From 5705b5afd1af029de6fd184e878e124f3623096c Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 11 Aug 2020 21:04:22 +0200 Subject: [PATCH] Always focus inputs on kanban when adding a new task or bucket --- src/main.js | 4 ++-- src/views/list/views/Kanban.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.js b/src/main.js index 3b867a92..3ac56056 100644 --- a/src/main.js +++ b/src/main.js @@ -134,12 +134,12 @@ Vue.use(vueShortkey) // Set focus Vue.directive('focus', { // When the bound element is inserted into the DOM... - inserted: el => { + inserted: (el, {modifiers}) => { // Focus the element only if the viewport is big enough // auto focusing elements on mobile can be annoying since in these cases the // keyboard always pops up and takes half of the available space on the screen. // The threshhold is the same as the breakpoints in css. - if (window.innerWidth > 769) { + if (window.innerWidth > 769 || (typeof modifiers.always !== 'undefined' && modifiers.always)) { el.focus() } } diff --git a/src/views/list/views/Kanban.vue b/src/views/list/views/Kanban.vue index 9b40a740..381d6be7 100644 --- a/src/views/list/views/Kanban.vue +++ b/src/views/list/views/Kanban.vue @@ -125,7 +125,7 @@ class="input" type="text" placeholder="Enter the new task text..." - v-focus + v-focus.always @focusout="toggleShowNewTaskInput(bucket.id)" @keyup.esc="toggleShowNewTaskInput(bucket.id)" @keyup.enter="addTaskToBucket(bucket.id)" @@ -161,7 +161,7 @@ class="input" type="text" placeholder="Enter the new bucket title..." - v-focus + v-focus.always @focusout="() => showNewBucketInput = false" @keyup.esc="() => showNewBucketInput = false" @keyup.enter="createNewBucket"