Add support for key events with autocomplete in Chrome#713
Conversation
In Google Chrome, when a text field has focus and an input suggestion is confirmed, a `keydown` event is fired. However, the event interface is not a `KeyboardEvent`, which causes the event handler to fail to determine whether it should be called. This change adds a test to ensure that the event handler is called correctly in this scenario.
|
We are affected by this as well and it causes our keydown triggers to trigger from the chrome autocomplete selections |
|
We're affected by this as well, selecting an autocomplete item with e.g., a |
|
Having this issue too in Safari. data-action="keydown.esc->modal#close" is triggered when selecting an autocomplete option. |
|
What is the status of this? |
|
Also curious as I just ran into it as well. |
|
I just discovered this issue as well. I have a Stimulus controller called form_controller where you can exit the input form by typing Escape. I have it set on keyup instead of keydown: FWIW, for the time being, my workaround is just to add this line (logic taken from this PR) inside the Stimulus method: if (!(e instanceof KeyboardEvent)) {
return;
}Hope this helps someone in my shoes! |
In Google Chrome, when a text field has focus and an input suggestion is confirmed, a
keydownevent is fired. However, the event interface is not aKeyboardEvent, which causes the event handler to fail to determine whether it should be called. This change adds a test to ensure that the event handler is called correctly in this scenario.I have created a minimal reproduction script; please setup Google Chrome to autocomplete the email address and select the candidate that appears. You will see that all event handlers are executed regardless of the key type.
https://codepen.io/tsmd/pen/rNQgoWg?editors=1010