Only focus inputs if the viewport is large enough (#55)
Only focus inputs if the viewport is large enough Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/55
This commit is contained in:
parent
96fddd9bbd
commit
8dcabc9385
1 changed files with 8 additions and 3 deletions
11
src/main.js
11
src/main.js
|
@ -113,9 +113,14 @@ import './registerServiceWorker'
|
|||
// Set focus
|
||||
Vue.directive('focus', {
|
||||
// When the bound element is inserted into the DOM...
|
||||
inserted: function (el) {
|
||||
// Focus the element
|
||||
el.focus()
|
||||
inserted: el => {
|
||||
// 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) {
|
||||
el.focus()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue