ccampbell / mousetrap

Simple library for handling keyboard shortcuts in Javascript
https://craig.is/killing/mice
Apache License 2.0
11.65k stars 967 forks source link

no support for hebrew+modifier keys #281

Open ittayd opened 9 years ago

ittayd commented 9 years ago

For example, the letter א is where the T key is. I can set a key binding for א, however, if I want a binding for alt+א, then I can't (there will be no response). I need to write 'alt-t'. This binding works when the setting for keyboard layout in the OS is either in the english or hebrew (not sure if this is good or not). However, the help screen shows the binding as alt-t while I wish it to be alt-א. The reason is the same as choosing ctrl-s for save, ctrl-o for open, etc.: to give some intuition to the user.

zomp commented 9 years ago

Hi @ittayd, do you mean alt+t or altgr+t, please?

ittayd commented 9 years ago

What is altgr+t

On Tue, Jun 23, 2015, 18:53 Jan Molnár notifications@github.com wrote:

Hi @ittayd https://github.com/ittayd, do you mean alt+t or altgr+t, please?

— Reply to this email directly or view it on GitHub https://github.com/ccampbell/mousetrap/issues/281#issuecomment-114555000 .

zomp commented 9 years ago

The right alt key (left and right alts are totally different keys – you can interchange left and right ctrls, shifts..., but you cannot interchange left and right alts).

ittayd commented 9 years ago

I used alt+t, and it works, but I wish i could use alt+א

On Tue, Jun 23, 2015, 21:04 Jan Molnár notifications@github.com wrote:

The right alt key (left and right alts are totally different keys – you can interchange left and right ctrls, shifts..., but you cannot interchange left and right alts).

— Reply to this email directly or view it on GitHub https://github.com/ccampbell/mousetrap/issues/281#issuecomment-114592281 .

zomp commented 9 years ago

I am sorry, I have just got it. I thought you are typing Alef by alt+t/altgr+t literally (... it is t, but if you press alt as well, you get א). Unfortunately I have no solution for this.

I have tested it on the Czech keyboard layout (we also have special letters mapped on plain keys) and I can confirm the issue – standalone ů (;/: key on the English layout) works, but in combination with alt, ctrl and shift it does not (Linux/Firefox).

This might be related to #143. There is a code snippet I extended by keydown event:

document.addEventListener('keypress', function(e) {
    console.log(e);
}, false);

The results for shift are IMO expected (IIUIC no OS/browser support):

keydown Shift { target: <body>, key: """, charCode: 0, keyCode: 162 }
keypress Shift { target: <body>, key: """, charCode: 34, keyCode: 0 }

But the results for ctrl and alt surprised me (the combination is supported – key detected):

keydown Control { target: <div#shortcutsModal.modal.ps-container.in.ps-active-y>, key: "ů", charCode: 0, keyCode: 162 }
keypress Control { target: <div#shortcutsModal.modal.ps-container.in.ps-active-y>, key: "ů", charCode: 367, keyCode: 0 }

That is all I know, only @ccampbell can save us. :-)