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
|
autofocus
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
@keyup="queryResults(query)"
|
@keyup="queryResults(query)"
|
||||||
|
@focus="scrollInputToTop()"
|
||||||
>
|
>
|
||||||
<div class="search-input-separator border-white border-t-2" />
|
<div class="search-input-separator border-white border-t-2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -93,6 +94,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import scrollIntoView from 'scroll-into-view-if-needed'
|
||||||
|
|
||||||
import appList from '~/assets/app-list.json'
|
import appList from '~/assets/app-list.json'
|
||||||
|
|
||||||
// import overlayStore from './mixins/store'
|
// import overlayStore from './mixins/store'
|
||||||
|
|
@ -173,6 +176,12 @@ export default {
|
||||||
array.splice(index, 1)
|
array.splice(index, 1)
|
||||||
return pluckedItem
|
return pluckedItem
|
||||||
},
|
},
|
||||||
|
scrollInputToTop () {
|
||||||
|
scrollIntoView(this.$refs['search'], {
|
||||||
|
block: 'start',
|
||||||
|
behavior: 'smooth'
|
||||||
|
})
|
||||||
|
},
|
||||||
queryResults (rawQuery) {
|
queryResults (rawQuery) {
|
||||||
// Clear any results from before
|
// Clear any results from before
|
||||||
this.titleStartsWithResults = []
|
this.titleStartsWithResults = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue