From bfba1d55adf3e82fe29b0888db12acdbceb507ec Mon Sep 17 00:00:00 2001
From: Florian Orben <florian.orben@gmail.com>
Date: Mon, 19 Oct 2015 03:10:36 +0200
Subject: No longer try to navigate to next/prev image if image preview modal
 is not open

---
 web/react/components/view_image.jsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'web/react/components/view_image.jsx')

diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx
index f75693470..322e68c17 100644
--- a/web/react/components/view_image.jsx
+++ b/web/react/components/view_image.jsx
@@ -6,6 +6,7 @@ const Utils = require('../utils/utils.jsx');
 const Constants = require('../utils/constants.jsx');
 const ViewImagePopoverBar = require('./view_image_popover_bar.jsx');
 const Modal = ReactBootstrap.Modal;
+const KeyCodes = Constants.KeyCodes;
 
 export default class ViewImageModal extends React.Component {
     constructor(props) {
@@ -63,11 +64,11 @@ export default class ViewImageModal extends React.Component {
         this.loadImage(id);
     }
     handleKeyPress(e) {
-        if (!e) {
+        if (!e || !this.props.show) {
             return;
-        } else if (e.keyCode === 39) {
+        } else if (e.keyCode === KeyCodes.RIGHT) {
             this.handleNext();
-        } else if (e.keyCode === 37) {
+        } else if (e.keyCode === KeyCodes.LEFT) {
             this.handlePrev();
         }
     }
-- 
cgit v1.2.3-1-g7c22

