octalmage / robotjs

Node.js Desktop Automation.

Home Page:http://robotjs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On Windows, LSHIFT keytap is sent when using `right_shift`

Madrox opened this issue · comments

Expected Behavior

When sending a keyTap or keyToggle event with a shift modifier, the proper shift key should be sent.

Current Behavior

Currently, lshift is called. This is likely also occuring with other modifiers like ctrl, as the switch logic collapses left vs right into a general modifier.

Possible Solution

Either refactor the modifier logic to distinguish between left and right to send the appropriate key press, or eliminate the right_shift modifier and retain shift as its inclusion is misleading.

Steps to Reproduce (for bugs)

  1. Install a windows key logging tool such as ShowOff: https://www.dcmembers.com/skrommel/download/showoff/
  2. Launch and observe the result of keyTap("f11", ["right_shift"])
  3. Notice LShift is the modifier

Context

I'm simulating the keypress of a global shortcut, and to distinguish it from normal user behavior in their current app, it should be bound purely to the right shift key (which is never used in their context).

Your Environment

  • RobotJS version: ^0.6.0
  • Node.js version: v14.16.1
  • npm version: 6.14.12
  • Operating System: Windows 10

By switching logic, I mean this code here:

else if(strcmp(f, "shift") == 0 || strcmp(f, "right_shift") == 0)

At this point, it seems the intented left/right keypress modifier is lost.