GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

03Keyboard cycling — picking items with arrows and wrapping to the far end via mod arithmetic

Computing the active index as (i + 1) % length makes ↓ from the last item glide back to the first. aria-activedescendant announces the position to screen readers, and scrollIntoView({block:'nearest'}) keeps the active item from hiding beyond the list edge.

Best forMandatory for keyboard users

keydownaria-activedescendantscrollIntoView
Keyboard cycling — picking items with arrows and wrapping to the far end via mod arithmetic
Open in a new tab

03 Keyboard cycling — picking items with arrows and wrapping to the far end via mod arithmetic — Measured area 35.733% · moving frames 23/23Original by GODRICH · SCSS and React ship in the zip · Autocomplete Input: 9 Search Dropdowns

The post this demo lives in

Autocomplete Input: 9 Search Dropdowns - preview of all 9 demosAutocomplete Input: 9 Search DropdownsAutocomplete input, explained: Bolds where letters sit in each suggestion, debounces requests, cycles the list by keyboa See all demos in this post

If you like this effect - similar demos