diff --git a/IPython/html/static/notebook/js/widgetmanager.js b/IPython/html/static/notebook/js/widgetmanager.js index eeff6eb..f8f0380 100644 --- a/IPython/html/static/notebook/js/widgetmanager.js +++ b/IPython/html/static/notebook/js/widgetmanager.js @@ -93,8 +93,14 @@ WidgetManager.prototype._handle_display_view = function (view) { // Have the IPython keyboard manager disable its event // handling so the widget can capture keyboard input. - // Note, this is only done on the outer most widget. - IPython.keyboard_manager.register_events(view.$el); + // Note, this is only done on the outer most widgets. + if (view.elements) { + for (var i = 0; i < view.elements.length; i++) { + IPython.keyboard_manager.register_events(view.elements[i]); + } + } else { + IPython.keyboard_manager.register_events(view.$el); + } }; WidgetManager.prototype.create_view = function(model, options, view) { diff --git a/IPython/html/static/notebook/js/widgets/widget_container.js b/IPython/html/static/notebook/js/widgets/widget_container.js index 8c7e172..0f04974 100644 --- a/IPython/html/static/notebook/js/widgets/widget_container.js +++ b/IPython/html/static/notebook/js/widgets/widget_container.js @@ -75,6 +75,14 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) { .mousedown(function(){ that.bring_to_front(); }); + + // Set the elements array since the this.$window element is not child + // of this.$el and the parent widget manager or other widgets may + // need to know about all of the top-level widgets. The IPython + // widget manager uses this to register the elements with the + // keyboard manager. + this.elements = [this.$el, this.$window] + this.$title_bar = $('
') .addClass('popover-title') .appendTo(this.$window)