Mac FN Key Detection Using Javascript

I want to grab the fn key on a Mac keyboard in my CMS application. Associating the event with a key and registering codes showed me that the key code returned by the fn key is 0 (zero).

I am tempted to take this for granted, but before I did this, I wanted to check with you guys and see if you think this is the correct code for this key, or just that the system has no idea how to interpret this particular key event.

It would be great to get some information here.

Thanks!

+6
source share
2 answers

I could be wrong here, but I think that you really cannot capture the Fn key, as if you had pressed the CTRL key. Fn + any other key will cause the actual keystroke or keystroke, as it allows you to press the F1-F12 keys. You may be able to use the shift key, but make sure that it does not perform text selection.

In jQuery, I would make $("#my-element").disableSelection() , and then see if the Shift + click works the way you want.

+2
source

If I'm not mistaken, you can capture the fn key as if it were shift, opt, or cmd. On a mountain lion, you can press fn twice to raise the dictation. Even on a lion, you can match fn as a control in some games (see HoN or Heroes of Newerth, where you can use fn as a control key). The problem is that I do not know how and cannot find a way to do this. But, as I said, I'm sure you can use it that way.

I don’t think this will work on windows due to bootcamp drivers, and I really hope someone comes up with a solution for this on bootcamp, since I hate it when the fn-ctrl keys are placed when I am on Windows.

+2
source

Source: https://habr.com/ru/post/902449/


All Articles