From 645183e51de85ce18171a782d9bf4e4041e6be66 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Wed, 23 Nov 2011 15:14:02 +0100 Subject: [PATCH] Intercept avoid closing websocket on Firefox Closes #1031; closes #1032 (rebased and fixed tiny typo) --- IPython/frontend/html/notebook/static/js/notebook.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 108f4c99a..a50dcb350 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -57,6 +57,11 @@ var IPython = (function (IPython) { $(document).keydown(function (event) { // console.log(event); if (that.read_only) return; + if (event.which === 27) { + // Intercept escape at highest level to avoid closing + // websocket connection with firefox + event.preventDefault(); + } if (event.which === 38) { var cell = that.selected_cell(); if (cell.at_top()) {