Why are phx-keydown / keyup "not supported" for input

Hi :slight_smile:

I am working on an input in a form with a custom autocomplete dropdown. I would like to realize it without a lot (or any) JS. I managed to create a working component, using phx-keydown events on the input. When keys like arrows, enter etc are pressed the autocomplete element is updated or the selected suggestion applied.

I am quite confused why it says in the docs that phx-keydown is not supported on inputs. The alternatives, installing a key listener on the window etc won’t work because I need to know in which element the keypresses originated. The other suggestion, to use phx-change also can’t support a UI like this, because I will get events when the content of the input changes but not when the user presses some arrow keys.

Does anyone know what “not supported” means here and why?

Tagging @josevalim because you added this note to the docs ( Improve container and phx-key docs · phoenixframework/phoenix_live_view@d485326 · GitHub )

Not a direct answer but the current element in the input is document.activeElement when you type