Skip to content

Commit

Permalink
AlphaNumeric check of keyCode
Browse files Browse the repository at this point in the history
Fixes davidtheclark/react-aria-menubutton#79

Change-Id: Ic59e59a87f59f4b2854aa07728cbffba6411b63b
  • Loading branch information
lekoaf committed Mar 5, 2019
1 parent b9de053 commit e03cb91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ FocusGroup.prototype._handleUnboundKey = function(event) {
}

// Only respond to letter keys
if (!isLetterKeyCode(event.keyCode)) return -1;
if (!isLetterOrNumberKeyCode(event.keyCode)) return -1;

// If the letter key is part of a key combo,
// let it do whatever it was going to do
Expand Down Expand Up @@ -260,8 +260,8 @@ function matchesEvent(matcher, event) {
return true;
}

function isLetterKeyCode(keyCode) {
return keyCode >= 65 && keyCode <= 90;
function isLetterOrNumberKeyCode(keyCode) {
return keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90;
}

function focusNode(node) {
Expand Down

0 comments on commit e03cb91

Please sign in to comment.