You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Use the keyboard to navigate down to the 'car' option.
Press enter on the keyboard to select.
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.
The text was updated successfully, but these errors were encountered:
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.
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 theenter
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.
https://codepen.io/eballeste/pen/qBdVmYW
onSelection
method of autoComplete.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.
The text was updated successfully, but these errors were encountered: