Open peder opened 7 years ago
@peder, in the future, please adhere to the issue template. It's there for a reason. I'm going to leave this open, however, as you've already submitted a PR. Please note that that PR needs work.
I'll get this and the PR cleaned up.
In the
getMatchesAsync
function, theactiveIdx
is set to0
iffocusFirst
is true and always to-1
if false. I would argue that if user has already entered a partial value and then hits tab, the user would want that value to be selected. Instead, hitting tab without first hitting the down arrow results in no value being selected.For instance, given a company field with values
['ABC Corp', 'XYZ Corp']
andtypeahead-focus-first='false'
, if a user clicks into the field, both values appear but neither is selected. If the user types inABC
, I thinkABC Corp
should become the selected value. It seems like this would be more intuitive then forcing the user to hit the down arrow--they could just hitTab
after typingABC
.Current:
scope.activeIdx = focusFirst ? 0 : -1;
Proposed:
scope.activeIdx = focusFirst ? 0 : inputValue && inputValue.length ? 0 : -1;