More complex example can be found here: http://h123.ru/-/tests/KeyboardEvent/
This demo uses polyfill from https://github.com/termi/DOM-Keyboard-Event-Level-3-polyfill
Enter some text with uppercase and lowercase letters:
Click button to create sintetic KeyboardEvent with predefined 'a' "key" and "char"
div_id_outout