I don't have a Mac, but I have seen its keyboard on pictures and there is a Control key. However the strange thing to me is that on most keyboards shortcuts, system/command key is used instead. Does the Control key on Mac behaves in exactly the same way as Ctrl key on Linux/Windows (in web browsers). To be more specifc, does it keyCode === 17 and does event.ctrlKey work for it?
I just want to implement Ctrl shortcuts for my web application and I'm wondering whether they will work on Macs.
Yes, the keyCode for the Ctrl key is the same on Mac and PC (17).
The keyCode for the command key is 91.
From a usability point of view, Mac's user are not very used to use the Ctrl key since all the common shortcuts use the command key instead. So it would be good if your application support both.
Related
I've written a game in Javascript on a Windows computer. I'm using onkeydown and onkeyup events to read key presses. My question is, do Macintosh computers use the same keyCodes as Windows? As I don't own a Mac I can't test if all the keys work the same way.
Short answer: Yes.
See https://www.w3.org/TR/uievents-code/ for a full list and comprehensive description.
I'm working on a text editor-esque product where we're manually handling certain actions on keydown, and I've been having a hard time figuring out how to distinguish between the event.key 'Control' and/or event.code 'ControlLeft'/'ControlRight' for Mac vs Windows, which obviously do different things.
Any advice on how to handle keydown between operating systems for things like this?
I'm developing a Kiosk application using Electron. But when I tested the app on an actual kiosk with windows 8 OS, the on screen key board is not launching. Is it possible I can manually enable keyboard by using JavaScript? I searched along for the answer but didn't got any proper answer. Also I would like to change the language of the keyboard with users preference? Can I do these using windows on screen keyboard?
How exactly you create kiosk mode? By replacing shell or/and use full screen application? If so - you need to use own internal keyboard. Windows keyboard available only if explorer running and no full screen application running.
I ran across this while researching a similar issue. If you are using a Windows Shell Launcher (details here), then you may still be in luck. The "Touch Keyboard and Handwriting Service" service is still available using this method. You can test that the keyboard is accessible by opening Task Manager and trying to run a new task. If the keyboard pops when you tap the input field there, the keyboard is working at the OS level.
If the keyboard is not opening at the OS level, it may require starting the Touch Keyboard service or setting a couple registry keys like:
HKCU\Software\Microsoft\TabletTip\1.7\EnableDesktopModeAutoInvoke = 1
HKCU\Software\Microsoft\windows\CurrentVersion\ImmersiveShell\TabletMode = 1
All of this said, there have been some issues with how Chrome interacts with the Touch Keyboard starting sometime around Chrome 49-50. Updating to the latest Chrome fixed the issue for me (51.0.2707.106m). I imagine there would also be some overlap since Electron uses Chromium from what I understand.
PS - I just realized this question was for Windows 8. Although my experiences were with Windows 10, I believe the same advice should apply.
Does anyone know how to return the operating system using Protractor?
A little context: I need to press some keys (I think I'll be using action sequence to do so) but as the keyboard is different for MAC and PC, I think I need an if statement detecting which OS I'm running the tests on. If anyone knows a better way to do this? It's further compounded by the keys being relatively unusual (fn + F10) on MAC and just F10 on PC.
Any help much appreciated!
Protractor runs on node, so you can use the inbuilt node variable process.platform.
Is there any library which can capture key events on any operating system and call the handler based on what action was performed?
For example, undo on Windows in cntrl+z, but on mac it is appleKey/commandkey + z.
So my question is is there any library that can call my undo handler on Windows as well as Mac?
Mousetrap seems like a pretty good start point. From there, you can detect the Apple key ('command') and different sequences and make your own custom aliases. Shouldn't be too difficult. :-)
http://craig.is/killing/mice