There are several libraries to handle keyboard bindings, for example:
https://github.com/RobertWHurst/KeyboardJS
Currently, however, the webclient has it's own implementation in view/input/base.tsx which is a shame as there are these libs who probably do it better.