# Keydown event fires continuously

**URL:** <https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513>\
**Category:** Web App Development\
**Created:** [February 8, 2024, 10:13pm UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513 "2024-02-08T22:13:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![max.cohen](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@max.cohen](https://forum.webostv.developer.lge.com/u/max.cohen)\
**Post date:** [February 8, 2024, 10:13pm UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513/1 "2024-02-08T22:13:01Z")

</div>

When using `window.addEventListenter("keydown", ...)` as well as `onkeydown` attached to an `input` element continuous events are fired even though only one key is pressed.

Steps to reproduce:

1. Focus input field
2. Blur input field
3. Refocus the same input field

→ Result: continuous keydown events are fired. This means if you entered the input field using the left arrow key, it would keep firing keydown events for the left arrow until leaving the input field.

---

<div class="post-metadata">

**Author:** ![max.cohen](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@max.cohen](https://forum.webostv.developer.lge.com/u/max.cohen)\
**Post date:** [February 8, 2024, 10:39pm UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513/2 "2024-02-08T22:39:32Z")

</div>

This only happens on webos, not on a browser.

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [February 13, 2024, 7:30am UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513/3 "2024-02-13T07:30:28Z")

</div>

In webOS TV apps, the virtual keyboard is always enabled when the input has focus and cannot be disabled. If the input has focus, the virtual keyboard will process the input. And the keypress, keyup and keydown event handlers do not work on the virtual keyboard. So if you need to get the input value, please use input or change event for that input field. You can find more information in [System UI Visibility](https://webostv.developer.lge.com/develop/guides/system-ui-visibility#visibility-of-the-virtual-keyboard). Thank you.

---

<div class="post-metadata">

**Author:** ![XRStudio](https://avatars.discourse-cdn.com/v4/letter/x/45deac/32.png) [@XRStudio](https://forum.webostv.developer.lge.com/u/XRStudio)\
**Post date:** [March 20, 2024, 5:19am UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513/4 "2024-03-20T05:19:58Z")

</div>

I’m getting the exact same behavior in the Simulators (22,23,24) and it appears to be a major bug/issue. It only continuously keeps firing a Arrow keydown event on the last form input element. I made a video (which I slowed down) so you can visually see what is happening.

[https://www.youtube.com/watch?v=ECvVgmO1wK0](https://www.youtube.com/watch?v=ECvVgmO1wK0)

It actually ends up stuck with focus stuck on the html body tag element (strange). The Continuous Arrow key event is from the RC and don’t stop until I use the Arrows on the RC.  
If use the Arrow Keys of my Keyboard I’m fighting against continuous RC Arrow Key Event.  
This appears to be a BUG with the Virtual Keyboard.

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [March 29, 2024, 6:25am UTC](https://forum.webostv.developer.lge.com/t/keydown-event-fires-continuously/5513/5 "2024-03-29T06:25:57Z")

</div>

Sorry for the late reply. As mentioned above, please do not use keypress, keyup and keydown event handlers on the virtual keyboard, except for the Enter and Back keys. Thank you.
