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

keyPress and keyRelease passing non ASCII values #7

Closed
Antix-Development opened this issue Feb 16, 2023 · 2 comments
Closed

keyPress and keyRelease passing non ASCII values #7

Antix-Development opened this issue Feb 16, 2023 · 2 comments
Assignees

Comments

@Antix-Development
Copy link

Antix-Development commented Feb 16, 2023

Me again,

I've just discovered that both keyPress and keyRelease events pass integers for keyboard keys 0-9, instead of their ASCII representations.

It's easy to fix in code but would be better if it didn't do that at all.

Again... awesome thing you have created, it opens a world of automation!

@ROGR3
Copy link
Owner

ROGR3 commented Feb 19, 2023

Hi!
First things first - Thank you very much! For using LepikJS, enjoying the work with it and even for opening the issue.
And I am sorry for later response...

Now, to the actual problem. I am aware of it.
It's wierd but I added this mechanic as a feature because of a simple reason which I came across.
The ASCII value of 0-9 on numeric keys is 48-57.
The ASCII value of 0-9 on numeric keyboard is 96-105. (Also this vary)
Here comes the issue, if it returned an ASCII value instead of number 0-9, the difference between clicking same number on different keys would appear. That is something that (atleast I, as a developer) do not like to manage.
Handling same input on 2 different ASCII values is not ideal.

So here is why it is 0-9 instead of ASCII values.

I would love to hear your opinion on this. Adding why do you prefer ASCII value over numbers would help me understand your problem more.

Also if you want to convert it to ASCII there is built in JS function .charCodeAt(0)

Thanks!

PS: It is not hard to implement this to LepikJS. I hope you got my point, that I do not want to implement something that could potentially cause issues in clicking same number anywhere else on keyboard.

@ROGR3 ROGR3 self-assigned this Feb 20, 2023
@Antix-Development
Copy link
Author

Hi no problem, I'm in no great rush :)

Really I'd prefer ASCII instead of numbers to skip the extra conversion using ${char}, it's no great issue and just another small bit of code.

I really raised the issue just in-case it was unintended on your part, however it was fully intended.. so all good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants