diff --git a/IPython/html/static/base/js/dialog.js b/IPython/html/static/base/js/dialog.js
index 92d2e3c..4154b28 100644
--- a/IPython/html/static/base/js/dialog.js
+++ b/IPython/html/static/base/js/dialog.js
@@ -64,6 +64,14 @@ IPython.dialog = (function (IPython) {
dialog.remove();
});
}
+ if (options.reselect_cell !== false) {
+ dialog.on("hidden", function () {
+ if (IPython.notebook) {
+ cell = IPython.notebook.get_selected_cell();
+ if (cell) cell.select();
+ }
+ });
+ }
return dialog.modal(options);
}