Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoComplete keyboard events interfere with original input keyboard events #104

Closed
3 tasks done
eballeste opened this issue Mar 7, 2020 · 2 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@eballeste
Copy link

eballeste commented Mar 7, 2020

  • Describe the bug

Let's say I add an event listener to the original input field where I want the user to be able to trigger certain actions by pressing enter from within the field. The field is not part of a form with a submit button. When I add autoComplete to the input field and the user uses the keyboard to select an option with the enter key, my original event is called first with whatever value was in the input before autoComplete's event takes place.

Is there something that could be added to the event so that I can add some logic to differentiate between an autocomplete event and my events.

  1. Type the letter a.
  2. Use the keyboard to navigate down to the 'car' option.
  3. Press enter on the keyboard to select.
  4. Notice how in console, my original event tied to the input gets called first with the value 'a' that I typed in, followed by the value captured in the onSelection method of autoComplete.
  • Expected behavior
    Not sure what the expected behavior is but I would like to find a way to determine if the keydown event was triggered by autoComplete or my script event listener.
@eballeste eballeste added the bug Something isn't working label Mar 7, 2020
@eballeste
Copy link
Author

for now, I'm doing a sloppy setTimeout of 50ms from within my original event which seems to do the trick but I feel like this might backfire on me somehow.

@TarekRaafat
Copy link
Owner

Hello @eballeste,

The issue has been resolved in v8.0 and above please try it and let me know your feedback.

Have a nice day, cheers! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants