Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

restrict date left/right arrows when focused within input

Edward Plato204d96b9a7db
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 2036fd1cf..83661e71c 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -372,12 +372,17 @@ class Timeline extends React.Component {
* @returns {void}
*/
handleKeyDown = (e) => {
- if (e.keyCode === 37) {
- e.preventDefault();
- this.throttleDecrementDate();
- } else if (e.keyCode === 39) {
- e.preventDefault();
- this.throttleIncrementDate();
+ // prevent left/right arrows changing date within inputs
+ if (e.target.tagName !== 'INPUT') {
+ // left arrow
+ if (e.keyCode === 37) {
+ e.preventDefault();
+ this.throttleDecrementDate();
+ // right arrow
+ } else if (e.keyCode === 39) {
+ e.preventDefault();
+ this.throttleIncrementDate();
+ }
}
};
/**
@@ -386,9 +391,11 @@ class Timeline extends React.Component {
* @returns {void}
*/
handleKeyUp = (e) => {
+ // left arrow
if (e.keyCode === 37) {
e.preventDefault();
this.stopLeftArrow();
+ // right arrow
} else if (e.keyCode === 39) {
e.preventDefault();
this.stopRightArrow();