Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifier keys are not properly released. #264

Closed
1 of 3 tasks
ccorcos opened this issue Aug 31, 2021 · 6 comments
Closed
1 of 3 tasks

Modifier keys are not properly released. #264

ccorcos opened this issue Aug 31, 2021 · 6 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ccorcos
Copy link

ccorcos commented Aug 31, 2021

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.)

@s1hofmann s1hofmann added this to the v2.0.0 milestone Sep 28, 2021
@s1hofmann s1hofmann added the bug Something isn't working label Sep 29, 2021
@theminor
Copy link

theminor commented Oct 2, 2021

For my system, releaseKey() doesn't seem to be working for any keys. The following code results in the S Key being held down and never released:

const { sleep, keyboard, Key } = require("@nut-tree/nut-js");

async function go() {
	await sleep(2000)
	await keyboard.pressKey(Key.S);
	await sleep(2000)
	await keyboard.releaseKey(Key.S);
}

go();

Using nut-js version 1.7.0 on Windows 10.

@s1hofmann
Copy link
Member

Hm, I initially suspected a timing issue, but if also happens with the additional sleep I doubt that. Will have to investigate further

@s1hofmann s1hofmann removed this from the v2.0.0 milestone Nov 7, 2021
@s1hofmann
Copy link
Member

Removed it from the 2.0.0 milestone since fixing this issue won’t necessarily require a major release

@s1hofmann s1hofmann added this to the TipTap milestone Jan 17, 2022
@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Apr 26, 2022
@ccorcos
Copy link
Author

ccorcos commented Apr 26, 2022

Hmm. Still an issue for me...

@s1hofmann
Copy link
Member

s1hofmann commented May 20, 2022

@ccorcos @theminor Would you be available to verify the latest snapshot solves #264 and #273?

npm i @nut-tree/nut-js@next

@s1hofmann s1hofmann mentioned this issue May 20, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants