diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js
index 28162bc04..6980b5e09 100644
--- a/IPython/html/static/notebook/js/codecell.js
+++ b/IPython/html/static/notebook/js/codecell.js
@@ -368,14 +368,6 @@ var IPython = (function (IPython) {
return false;
};
- CodeCell.prototype.command_mode = function () {
- var cont = IPython.Cell.prototype.command_mode.apply(this);
- if (cont) {
- this.focus_cell();
- };
- return cont;
- }
-
CodeCell.prototype.edit_mode = function () {
var cont = IPython.Cell.prototype.edit_mode.apply(this);
if (cont) {
diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js
index 6b46e9d83..c51f082ae 100644
--- a/IPython/html/static/notebook/js/keyboardmanager.js
+++ b/IPython/html/static/notebook/js/keyboardmanager.js
@@ -131,6 +131,7 @@ var IPython = (function (IPython) {
help : 'command mode',
handler : function (event) {
IPython.notebook.command_mode();
+ IPython.notebook.focus_cell();
return false;
}
},
@@ -138,6 +139,7 @@ var IPython = (function (IPython) {
help : 'command mode',
handler : function (event) {
IPython.notebook.command_mode();
+ IPython.notebook.focus_cell();
return false;
}
},
diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js
index 31e715c6c..c301950cf 100644
--- a/IPython/html/static/notebook/js/notebook.js
+++ b/IPython/html/static/notebook/js/notebook.js
@@ -547,6 +547,11 @@ var IPython = (function (IPython) {
};
};
+ Notebook.prototype.focus_cell = function () {
+ var cell = this.get_selected_cell();
+ if (cell === null) {return;} // No cell is selected
+ cell.focus_cell();
+ };
// Cell movement
diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js
index 7722ca444..4ae313511 100644
--- a/IPython/html/static/notebook/js/textcell.js
+++ b/IPython/html/static/notebook/js/textcell.js
@@ -204,14 +204,6 @@ var IPython = (function (IPython) {
this.render();
};
- TextCell.prototype.command_mode = function () {
- var cont = IPython.Cell.prototype.command_mode.apply(this);
- if (cont) {
- this.focus_cell();
- };
- return cont;
- }
-
TextCell.prototype.edit_mode = function () {
var cont = IPython.Cell.prototype.edit_mode.apply(this);
if (cont) {