react-autowhatever icon indicating copy to clipboard operation
react-autowhatever copied to clipboard

Make a suggestion always highlighted

Open ericbiewener opened this issue 8 years ago • 2 comments

Previously requested (but then closed by requestor) here. Currently, pressing down on the last item in the list causes no suggestions to be highlighted until another arrow key press. I'd like to be able to have it immediately cycle back to the first one. This could be configurable via a prop.

I'd be happy to submit a PR for this.

ericbiewener avatar Aug 15 '17 23:08 ericbiewener

This will be against the WAI-ARIA guidelines:

pressing the down arrow when the last choice is highlighted will move focus back to the text box, pressing down again will move focus to the first item in the list.

What's your reasoning to go against the guidelines?

moroshko avatar Aug 15 '17 23:08 moroshko

The guidelines suggest that no item should be highlighted under the case in question because instead it "will move focus back to the text box." However, this is irrelevant given the current functionality of this library since the text input never actually loses focus (or perhaps it's React Autosuggest that is responsible for that functionality). Therefore, being able to un-highlight all suggestions doesn't really seem to serve a purpose.

ericbiewener avatar Aug 16 '17 00:08 ericbiewener