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

Adding charCode compare(multilanguage support) #456

Closed
wants to merge 5 commits into from

Conversation

Quieska
Copy link

@Quieska Quieska commented Apr 6, 2020

Added charCode compare(multilanguage support)
The proplem it fixed is hotkeys (ctrl+z, ctrl+c ... etc.) not working in other locales.
Now hotkeys working in all languales (Russian, Serbian... etc.) :)

@CLAassistant
Copy link

CLAassistant commented Apr 6, 2020

CLA assistant check
All committers have signed the CLA.

@nikku
Copy link
Member

nikku commented Apr 7, 2020

Thanks for your PR!

Could you elaborate on what you do and why?

If you contribute fixes, please also consider adding accompanying test cases.

@Quieska
Copy link
Author

Quieska commented Apr 7, 2020

keys.indexOf(event.key) > -1
keys is an array [z, Z].
event.key in English locale is "z" for example, but in my another locale it is "я"
It's not working with finding String.
It can be fixing by taking event.keyCode, transform to String and search it in keys array

@Quieska
Copy link
Author

Quieska commented Apr 16, 2020

Thanks for your PR!

Could you elaborate on what you do and why?

If you contribute fixes, please also consider adding accompanying test cases.

Hello! Thanks for your reply!
I made some test cases. You can remove comparing by keyCode and see that new test cases failing :)

@nikku
Copy link
Member

nikku commented Apr 16, 2020

To better understand your case you'd still press CTRL + я on your keyboard as a UNDO shortcut?

@Quieska
Copy link
Author

Quieska commented Apr 16, 2020

To better understand your case you'd still press CTRL + я on your keyboard as a UNDO shortcut?

Yes, all shortcuts works like earlier, but not only in english locale

@nikku
Copy link
Member

nikku commented Apr 16, 2020

This is an interesting detail, indeed.

Looking at my german keyboard (where Z and Y are swapped): Given your solution, pressing the English keyboard shortcut would yield CTRL + Z even though it says CTRL + Y and I'd expect it to REDO.

Guess we'll need to investigate this issue a little further.

@nikku nikku added the backlog Queued in backlog label Apr 16, 2020 — with bpmn-io-tasks
@Quieska
Copy link
Author

Quieska commented Apr 16, 2020

This is an interesting detail, indeed.

Looking at my german keyboard (where Z and Y are swapped): Given your solution, pressing the English keyboard shortcut would yield CTRL + Z even though it says CTRL + Y and I'd expect it to REDO.

Guess we'll need to investigate this issue a little further.

So look on it not like CTRL+Z(on english) or CTRL+Y(on german) or CTRL+Я(on russian)
It CTRL+KeyCode = 90 for UNDO for all locales. That what i did.

@philippfromme
Copy link
Contributor

Actually, undoing on a German keyboard is CTRL + Z, the physical key is just somewhere else on the keyboard.

@philippfromme
Copy link
Contributor

So the issue is that key is referring to the character that's generated whereas both keyCode and the more recent key refer to the physical key on the keyboard. Since we're only using key right now the shortcuts are working on QWERTY-based Latin-script keyboard layouts but not on others. We should use both key and as a fallback keyCode to ensure the shortcuts are working properly on all keyboards.

@philippfromme
Copy link
Contributor

We shouldn't use charCode as it's both non-standard and deprecated.

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on needs review Review pending and removed backlog Queued in backlog in progress Currently worked on labels Apr 20, 2020
@fake-join fake-join bot closed this in #460 Apr 20, 2020
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Apr 20, 2020
@philippfromme
Copy link
Contributor

Hey @Quieska,

since I have not received a response from you I took over this PR and finished it. Thank you for bringing up this topic. In future releases, the shortcuts will work across all keyboards.

Closed via #460.

@Quieska
Copy link
Author

Quieska commented Apr 21, 2020

Hello @philippfromme!
Nice to hear it. I saw your PR and think it will work fine, especially you tested it on russian keyboard) Thanks for fast work! Me and my company waiting for future release.

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

Successfully merging this pull request may close these issues.

4 participants