At first, I would like to use only native JavaScript to accomplish this task.
Let's say I have to create an individual drop-down list, and the HTML code looks something like this.
<div class="dropdown">
<span class="dropdown-label" style="display:block">Select a thing</span>
<ul class="dropdownItemContainer">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
In the CSS file, I have something close to this:
ul.dropdownItemContainer li:hover {
background-color: #FF0000;
}
Yes, in fact, there is no downward behavior, but this is not the point of discussion in fact. The problem is that I could not come up with a decent way to enable keyboard controls for this drop-down list. The desired result is as follows: I press the down key, and the first parameter is highlighted; I click it again, and the second option is highlighted, etc.
, ( JS), - ul, stick'em JS- "".
, : hover, CSS . ?