This function is a helper for keyboard navigation through dropdowns.
The index of the element you're on
The orientation of the dropdown
Array of refs to the items in the dropdown
This function is a helper for keyboard navigation through dropdowns.