mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Scroll search to top when focused
This commit is contained in:
parent
f4bf6df4b1
commit
85c48a5b18
1 changed files with 9 additions and 0 deletions
|
|
@ -12,6 +12,7 @@
|
|||
autofocus
|
||||
autocomplete="off"
|
||||
@keyup="queryResults(query)"
|
||||
@focus="scrollInputToTop()"
|
||||
>
|
||||
<div class="search-input-separator border-white border-t-2" />
|
||||
</div>
|
||||
|
|
@ -93,6 +94,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import scrollIntoView from 'scroll-into-view-if-needed'
|
||||
|
||||
import appList from '~/assets/app-list.json'
|
||||
|
||||
// import overlayStore from './mixins/store'
|
||||
|
|
@ -173,6 +176,12 @@ export default {
|
|||
array.splice(index, 1)
|
||||
return pluckedItem
|
||||
},
|
||||
scrollInputToTop () {
|
||||
scrollIntoView(this.$refs['search'], {
|
||||
block: 'start',
|
||||
behavior: 'smooth'
|
||||
})
|
||||
},
|
||||
queryResults (rawQuery) {
|
||||
// Clear any results from before
|
||||
this.titleStartsWithResults = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue