From 43160ea2886b7d35ce1ee9908f18e497ed1aaeef Mon Sep 17 00:00:00 2001 From: Samuel Meuli Date: Mon, 15 Oct 2018 22:31:23 +0200 Subject: [PATCH] fix navigation with arrow keys (#160) * fix navigation with arrow keys * replace deprecated KeyboardEvent.keyCode --- assets/src/js/components/DatePicker.js | 4 ++-- assets/src/js/components/SiteSettings.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/src/js/components/DatePicker.js b/assets/src/js/components/DatePicker.js index 8ffadf06..d3dce202 100644 --- a/assets/src/js/components/DatePicker.js +++ b/assets/src/js/components/DatePicker.js @@ -169,7 +169,7 @@ class DatePicker extends Component { @bind handleKeyPress(evt) { // Don't handle input when the user is in a text field or text area. - let tag = event.target.tagName; + let tag = evt.target.tagName; if(tag === "INPUT" || tag === "TEXTAREA") { return; } @@ -178,7 +178,7 @@ class DatePicker extends Component { let diff = this.state.endDate - this.state.startDate + 1000; let newStartDate, newEndDate; - switch(evt.keyCode) { + switch(evt.which) { // left-arrow case 37: newStartDate = new Date(+this.state.startDate - diff) diff --git a/assets/src/js/components/SiteSettings.js b/assets/src/js/components/SiteSettings.js index 502ed211..943fe789 100644 --- a/assets/src/js/components/SiteSettings.js +++ b/assets/src/js/components/SiteSettings.js @@ -89,7 +89,7 @@ class SiteSettings extends Component { @bind handleKeydownEvent(evt) { // close modal when pressing ESC - if(evt.keyCode == 27) { + if(evt.which == 27) { this.props.onClose() } }