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

Fix for Copy&Paste events not working properly in non-English keyboard event #2097

Merged
merged 5 commits into from
Oct 21, 2020
Merged

Conversation

Yaron24
Copy link
Contributor

@Yaron24 Yaron24 commented Jul 21, 2020

Ctrl+V and Ctrl+C events are not detected when the keyboard language is not set on English. The condition for the copy/paste event is if event.code equals to 'c' or 'v'. This results in the non-English character showing the the selected cell instead of triggering a copy/paste event. For example 'C' in Hebrew is 'ב':

image

The suggested commit is using event.keyCode (cKey = 67, vKey = 86) instead of event.code to detect the event in non-English keyboard layouts.

@nstepien
Copy link
Contributor

LGTM, thanks!

I'd rather not use keyCode as it's "obsolete" according to the mdn docs, but using event.key isn't good enough for Hebrew input, and event.nativeEvent.code isn't good enough for the English DVORAK layout either.

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

Copy link
Contributor

@amanmahajan7 amanmahajan7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix

@nstepien nstepien merged commit 132ebb6 into adazzle:canary Oct 21, 2020
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.

None yet

3 participants