From e57bab55c27124854e59653ed46d7d2e984a3f03 Mon Sep 17 00:00:00 2001 From: mzabriskie Date: Mon, 10 Nov 2014 16:00:03 -0700 Subject: [PATCH] [fixed] Issue with focus being lost - closes #9 --- lib/components/ModalPortal.js | 7 ++++--- package.json | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/components/ModalPortal.js b/lib/components/ModalPortal.js index da496f8d..54ad7c65 100644 --- a/lib/components/ModalPortal.js +++ b/lib/components/ModalPortal.js @@ -70,8 +70,10 @@ var ModalPortal = module.exports = React.createClass({ }, maybeFocus: function() { - if (this.props.isOpen) + if (this.props.isOpen && + !this.refs.content.getDOMNode().contains(document.activeElement)) { this.focusContent(); + } }, focusContent: function() { @@ -109,7 +111,7 @@ var ModalPortal = module.exports = React.createClass({ }, requestClose: function() { - if (this.ownerHandlesClose) + if (this.ownerHandlesClose()) this.props.onRequestClose(); }, @@ -152,4 +154,3 @@ var ModalPortal = module.exports = React.createClass({ ); } }); - diff --git a/package.json b/package.json index 803629b1..71cfabe9 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "karma-mocha": "0.1.3", "mocha": "1.20.1", "react": ">=0.11.0", - "react-tap-event-plugin": "git://github.com/appsforartists/react-tap-event-plugin", "reactify": "^0.14.0", "rf-release": "0.3.1", "uglify-js": "2.4.15",