Skip to content

Commit

Permalink
fix: πŸ› don't fire typing event on modifier keys pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Apr 18, 2019
1 parent c39ec48 commit ce76edf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/useStartTyping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const isFocusedElementEditable = () => {
return activeElement.hasAttribute('contenteditable');
};

const isTypedCharGood = ({ keyCode }: KeyboardEvent) => {
const isTypedCharGood = ({ keyCode, metaKey, ctrlKey, altKey }: KeyboardEvent) => {
if (metaKey || ctrlKey || altKey) {
return false;
}
// 0...9
if (keyCode >= 48 && keyCode <= 57) {
return true;
Expand Down

0 comments on commit ce76edf

Please sign in to comment.