Skip to content

Modifier keys are not properly released. #264

Closed
@ccorcos

Description

@ccorcos

Version

"@nut-tree/nut-js": "^1.7.0",

Short overview

I'm running this program:

import * as nut from "@nut-tree/nut-js"

async function main() {
	await nut.sleep(2000)
	await nut.keyboard.pressKey(nut.Key.LeftSuper, nut.Key.LeftShift, nut.Key.P)
	await nut.keyboard.releaseKey(nut.Key.LeftSuper, nut.Key.LeftShift, nut.Key.P)

	await nut.keyboard.type("Open Document")

	await nut.keyboard.pressKey(nut.Key.Enter)
	await nut.keyboard.releaseKey(nut.Key.Enter)
}

main()

And in javascript (Chrome), I'm logging the document keydown events:

document.addEventListener("keydown", event => {
		console.log(
			"keydown",
			event.key,
			event.shiftKey,
			event.metaKey,
			event.altKey,
			event.ctrlKey
		)
});

And the result: Shift and Meta keys are still held down when typing. Although they turn off after enter...

Screen Shot 2021-08-30 at 11 34 03 PM

Issue occurs on

  • Virtual machine
  • Docker container
  • Dev/Host system -- MacOS

Detailed error description

Steps to reproduce error

Additional content

Please provide any (mandatory) additional data to reproduce the error (Dockerfiles etc.)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions