ng2-ui / auto-complete

Angular Auto Complete component and directive
http://ng2-ui.github.io/auto-complete/
MIT License
279 stars 124 forks source link

Enter/tab does not behave as expected. #242

Closed will093 closed 6 years ago

will093 commented 7 years ago

Current behavior

Expected/desired behavior

allenhwkim commented 7 years ago

@evasquez26 can you answer this question? He is expecting the opposite behaviour than your PR.

ghost commented 7 years ago

Sure :) @will093 can you explain a bit more about the case of use?

As described here https://github.com/ng2-ui/auto-complete/issues/207 what we wanted was a way to let the user write what he wants and if something matches their search then they could select it from the list, something like google does with their search, they don't automatically select the first thing that comes up, it let's you choose but also to write down whatever you want

raviji commented 7 years ago

Am also facing the issue on these. I need exactly google does.

  1. By default first value should not be selected in the list - Working
  2. When press Enter/return button then it goes undefined
  3. When press Up key / Down key auto suggest list navigating properly but not like google does. We need to navigate to entered value also, right now its navigating to only in the list, if you keep press down/up button then that input box value has to select first and then dropdown value second.
will093 commented 7 years ago

@raviji @evasquez26 My use case is a little different from yours.

I have a form where the user picks from a list of possible options, but as there are several hundred options a simple dropdown select is not a good choice. In my use case accept-user-input is set to false.

The idea is this:

  1. The user knows which option they are looking for, so they type the first few characters.
  2. The user sees either one or several items appear in the list.
  3. The user either clicks on one of these, or hits enter/tab to select the top item in the list (this part doesn't work with the current behaviour).

In particular, it seems very odd with the current behaviour and accept-user-input when the user types until there is only 1 remaining list item, hits tab, and the value reverts to what it was previously.

I think some kind of highlight-first-result input flag might be good to at least give people that option.

lemarsu commented 7 years ago

Add PR #244 that permit the old behaviour.

ghost commented 7 years ago

Thank you @will093 and @lemarsu for the PR I was thinking of making this optional :)

Thanks @raviji maybe it's better better to open a new issue with that you have described because I think it's kind of different than the main issue.

raviji commented 7 years ago

@evasquez26 Thank you and sure I will open a new ticket for this.

lemarsu commented 7 years ago

Added PR #245 with better input name and little doc in README.md.