I
I
Igor2019-07-13 03:23:37
Vue.js
Igor, 2019-07-13 03:23:37

Focus ul li, how to make ul li respond to the up down keys on the keyboard?

After reading the documentation, it was not possible to implement the plan.
5d28daa793034490732336.gif
The problem is that after the user enters a search query, it is likely that he will press the down button to go to the list and navigate already on the keyboard.
Something like Google, enter a search query and immediately press down.
Here is my frame

<template>
    <div class="input-group input-group-lg">
        <input type="search"
               class="form-control"
               placeholder="Поиск компаний"
               v-model="search_value"
               v-on:input="ChangeInput"
               autocomplete="off"
        >
        <div class="result-search" v-if="items.length > 0 && search_value" tabindex="0">
            <ul @keydown="keydown" tabindex="1">
                <li v-for="(item, index) in items" @click="Select(item)" tabindex="-1">{{item.name}}</li>
            </ul>
        </div>
    </div>
</template>

The only thing I will say is that the focus is as it is, but not as in the ListBox
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question