Betaflight-configurator: Keyboard shortcuts do not work on <input type="number"/> elements

Created on 19 Jun 2020  路  7Comments  路  Source: betaflight/betaflight-configurator

Keyboard shortcuts like Ctrl+C, Ctrl+V, Ctrl+A, etc. in <input type="number"/> elements do not work (i.e. text is not copied or pasted, "all text" is not selected). The corresponding items in the context menu _do_ work as expected.
image

To reproduce, go to any tab in Configurator that has <input type="number"/> elements. Try to use the keyboard shortcuts as shown in the context menu.

This issue occurs in Windows. I dot know if it is the same in other OSs. @mikeller suggested that it might be due to switching from using Chrome Windows to NW.js Windows.
If someone could volunteer to try and duplicate it on Linux, Mac, or Android, it would be much appreciated

bug

All 7 comments

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.89. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Not exactly... it seems we intercept all the key presses and only let continue a 'whitelist'...

https://github.com/betaflight/betaflight-configurator/blob/a52efd7ec818b650295dc5b6e1c05b936e2053f5/src/js/main.js#L478-L491

I'm not sure what was the reason of doing this, but this code is here since at least 6 years ago...

Not exactly... it seems we intercept all the key presses and only let continue a 'whitelist'...

I'm not sure what was the reason of doing this, but this code is here since at least 6 years ago...

Since .keyCode has been deprecated in favor of .code, it might be a good idea to change it. Unless someone knows if there is a specific reason for that event handler to exist, it would be even better to just remove it entirely. If I have some time this weekend, I will dig into it and create a PR if it doesn't break anything obvious. I can't possibly test every single number input in configurator myself, but we can always revert it, if necessary.

If you can create a better version this weekend it will very appreciated. I will be out so I can't do it by myself.

Same behavior on Ubuntu 20.04, Keyboard shortcut's don't work but the corresponding items in the context menu do - not surprising with the whitelist in place.

Lol, good find @McGiverGim - I'd never come across this. :grinning:

This seems to be something that is most likely not needed any more in the current runtime environments, it should probably be removed altogether.

@MadQ your PR was closed, it seems on your side. Can you confirm if this was intended?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richard-scott picture richard-scott  路  4Comments

Stavr0s91i picture Stavr0s91i  路  5Comments

bizmar picture bizmar  路  5Comments

JyeSmith picture JyeSmith  路  5Comments

McGiverGim picture McGiverGim  路  3Comments