How to get Key value if input data are event.code and current keyboard layout

I want to implement my own virtual keyboard which constructed in dynamic way.

I’d like to use event.code as key selector.

To make it supporting different system languages I need to prepare data maps where from I could take key-data: event key value, event.location, event.which.

Events that are real events accompanied by keystrokes. Consider each of this you can using internet resources like keycode.info or mdn-doc.

I do not have ones at time when my keyboard is under dynamic construction.

The idea is to avoid of using map per language layout. I’d like to know key value using code name, location and current layout.

for example:

keyboard layout | event.location | event.which | event.code | event.key ------------------------------------------------------------------------        de       |       0        |      59     |  Semicolon |     ö ------------------------------------------------------------------------        en       |       0        |      59     |  Semicolon |     ; ------------------------------------------------------------------------        uk       |       0        |      59     |  Semicolon |     ж ------------------------------------------------------------------------ 

considering table:

  • event.location is order key number for each unique key;
  • event.which is deprecated code to detect physical key on keyboard;
  • event.code is a code to detect physical key on keyboard;
  • event.key – value which I need depending on keyboard layout.

So we have a chances somehow to detect key if input data are code and layout for which we need the key.

Is there ideas how to get key not from event but from browser?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.