stimulus-autocomplete icon indicating copy to clipboard operation
stimulus-autocomplete copied to clipboard

Auto-select/highlight the first result on "data load ended"

Open StanBright opened this issue 2 years ago • 2 comments

Hey, many thanks for this "simple" and effective stimulus controller.

I've been replacing ReactSelect throughout my apps with it.

However, there's still some UX that's bugging me. I'd like to have the first result automatically highlighted so that the user can press enter and select it. A good example is GitHub's search box in the navbar here.

Any ideas what's the easiest way to achieve that?

Thanks, Stan

StanBright avatar Jul 06 '22 05:07 StanBright

That's a nice question, it would "force" a selection. I wanted this kind of selection or on "focus out", make the field blank for forcing html5 required validation. Any clues on how to do this ? Ping @afcapel

apsylone avatar Feb 28 '23 15:02 apsylone

@apsylone did you manage to find a solution :)?

StanBright avatar May 29 '23 05:05 StanBright