4 ms·
The closest semantics I found were the location hints: https://developer.mozilla.org/en/DOM/KeyboardEvent#Key_location_constants https://developer.mozilla.org/e
by obtu 14y ago
The closest semantics I found were the location hints: https://developer.mozilla.org/en/DOM/KeyboardEvent#Key_location_constants https://developer.mozilla.org/en/DOM/KeyboardEvent#Key_locat...
The problem is, only the keyboard hardware knows where the keys are physically located. The OS knows the layout and could probably expose the QWERTY-equivalent keys, which would be sufficient for not-too-exotic keyboards, but I don't know if that is available to applications in a way that is sufficiently portable for browsers to expose it.
Chromium seems to expose this to Pepper plugins; here is the bug for making it an experimental js api: https://code.google.com/p/chromium/issues/detail?id=119362 https://code.google.com/p/chromium/issues/detail?id=119362
Getting the lowlevel keycode is nonportable (I didn't find the implementation, but found switch cases and fallbacks if it doesn't exist). Conversion to a portable usb-hid-equivalent keycode is left as a stub in the patch that introduced the Pepper feature.