From b206ed708ad7baa547c6f305cac58c36e6615658 2014-02-13 19:22:17 From: Min RK Date: 2014-02-13 19:22:17 Subject: [PATCH] Merge pull request #5121 from minrk/fix-remove-enable fix remove event in KeyboardManager.register_events --- diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index a6df32a..07703b9 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -752,9 +752,11 @@ var IPython = (function (IPython) { }); // There are times (raw_input) where we remove the element from the DOM before // focusout is called. In this case we bind to the remove event of jQueryUI, - // which gets triggered upon removal. + // which gets triggered upon removal, iff it is focused at the time. e.on('remove', function () { - that.enable(); + if (document.activeElement === e[0]) { + that.enable(); + } }); }