Monitor the keyboard input of the web page and fill it into the input box automatically if it is text.

question: there is a requirement that if the input box is not currently focused, but the keyboard is pressed, the input will be automatically populated into the input box.
my implementation is to listen to document.keydown, to determine keycode, and set the input box focus when it is an input character. This kind of implementation is no problem for English, but if the Chinese input method is turned on, then the document.keydown will not be able to monitor, and it will not be able to judge focus, how should it be done?
PS: is a client made of qt, and the interface is implemented at the front end.

Mar.18,2021

the keyCode of the Chinese input method equals 229, which makes you feel like an endless loop. no, no, no. If there is nothing to gain focus, it is impossible to trigger the Chinese input method. You can get a hidden input box and use it to get focus

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b366f9-41054.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b366f9-41054.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?