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:
konrad 2020-01-31 16:19:04 +00:00
parent 96fddd9bbd
commit 8dcabc9385

View file

@ -113,10 +113,15 @@ import './registerServiceWorker'
// Set focus
Vue.directive('focus', {
// When the bound element is inserted into the DOM...
inserted: function (el) {
// Focus the element
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()
}
}
})
// Check the user's auth status when the app starts