Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Map key code for digit keys to the corresponding digits. #1746

Merged
merged 4 commits into from Oct 2, 2012

Conversation

RaymondLim
Copy link
Contributor

This fixes issue #1745 for all keyboard layouts including French which has digit keys as shifted keys.

…cut with digit keys and Shift key will function correctly.
@ghost ghost assigned jasonsanjose Oct 2, 2012
@jasonsanjose
Copy link
Member

reviewing

// If keycode represents one of the digit keys (0-9), then return the corresponding digit
// by subtracting KeyEvent.DOM_VK_0 from keycode. ie. [48-57] --> [0-9]
if (keycode >= KeyEvent.DOM_VK_0 && keycode <= KeyEvent.DOM_VK_9) {
return keycode - KeyEvent.DOM_VK_0;
Copy link
Member

Choose a reason for hiding this comment

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

We should explicitly return a string here: return Number(keycode - KeyEvent.DOM_VK_0).toString()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

I think you could also just do String(keycode - KeyEvent.DOM_VK_0)

@jasonsanjose
Copy link
Member

Initial review complete

@jasonsanjose
Copy link
Member

Merging

jasonsanjose added a commit that referenced this pull request Oct 2, 2012
Map key code for digit keys to the corresponding digits.
@jasonsanjose jasonsanjose merged commit b2f32e0 into master Oct 2, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants