From cf53c6c3ae8d908e7401f68b205d396a4e25f1f0 Mon Sep 17 00:00:00 2001 From: Samuel Meuli Date: Mon, 15 Oct 2018 21:12:52 +0200 Subject: [PATCH 1/2] fix navigation with arrow keys --- assets/src/js/components/DatePicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/src/js/components/DatePicker.js b/assets/src/js/components/DatePicker.js index 8ffadf06..b6cd8592 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; } From 4496b7e97e5e415b27808db7a42d77b7bc638274 Mon Sep 17 00:00:00 2001 From: Samuel Meuli Date: Mon, 15 Oct 2018 21:13:36 +0200 Subject: [PATCH 2/2] replace deprecated KeyboardEvent.keyCode --- assets/src/js/components/DatePicker.js | 2 +- assets/src/js/components/SiteSettings.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/src/js/components/DatePicker.js b/assets/src/js/components/DatePicker.js index b6cd8592..d3dce202 100644 --- a/assets/src/js/components/DatePicker.js +++ b/assets/src/js/components/DatePicker.js @@ -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() } }