I narrowed the issue down to the _OnDockableNodeClick function in the AnchorBarController - Widget.js file starting at line 630. The following original code creates and shows a panel, in particular lines 30-40. Unfortunately, this loads a panel even when one already exists and the lang.hitch and aspect.after were adding additional ‘onClose’ events each time a panel was opened.
_onDockableNodeClick: function(dockableItem){
var panelId, panelConfig;
if(dockableItem.config.inPanel === false){
if(dockableItem.isOpen){
this.widgetManager.loadWidget(dockableItem.config).then(
lang.hitch(this, function(widget) {
this._addToOpenedIds(dockableItem.config.id);
var position = this._getOffPanelPosition(dockableItem,
this.widgetManager.getWidgetMarginBox(widget));
position.zIndex = 100;
widget.setPosition(position, this.containerNode);
this.widgetManager.openWidget(widget);
this.own(aspect.after(widget, 'onClose', lang.hitch(this, function() {
dockableItem.setOpened(false);
this._removeFromOpenedIds(dockableItem.config.id);
dockableItem.iconItemNode.focus();
})));
}));
}else{
this.widgetManager.closeWidget(dockableItem.config.id);
this._removeFromOpenedIds(dockableItem.config.id);
}
}else{
panelId = dockableItem.config.id + '_panel';
if(dockableItem.isOpen){
dockableItem.setPanelIndex(this._calPanelIndex());
panelConfig = dockableItem.getConfigForPanel();
this.panelManager.showPanel(panelConfig).then(lang.hitch(this, function(panel){
panel.setPosition(panelConfig.panel.position);
aspect.after(panel, 'onClose', lang.hitch(this, function(){
dockableItem.setOpened(false);
this._removeFromOpenedIds(dockableItem.config.id);
if(dockableItem.iconItemNode){
dockableItem.iconItemNode.focus();
}
}));
}));
if(this.popupMore){
this.popupMore.hide();
}
this._addToOpenedIds(dockableItem.config.id);
}else{
this.panelManager.closePanel(panelId);
this._removeFromOpenedIds(dockableItem.config.id);
}
}
},
I added a conditional (Lines 30-32) to only to create the panel if the panel ID does not exist, which seems to have resolved the issue. I also comment out line 37 as the panel.setPosition is being called twice. I am not a programmer, so please provide some feedback. I also did not look at the upper portion, which deals with off Panel widgets. This revision also does not reset the panel position/size for existing panels or the panelIndex.
_onDockableNodeClick: function(dockableItem){
var panelId, panelConfig;
if(dockableItem.config.inPanel === false){
if(dockableItem.isOpen){
this.widgetManager.loadWidget(dockableItem.config).then(
lang.hitch(this, function(widget) {
this._addToOpenedIds(dockableItem.config.id);
var position = this._getOffPanelPosition(dockableItem,
this.widgetManager.getWidgetMarginBox(widget));
position.zIndex = 100;
widget.setPosition(position, this.containerNode);
this.widgetManager.openWidget(widget);
this.own(aspect.after(widget, 'onClose', lang.hitch(this, function() {
dockableItem.setOpened(false);
this._removeFromOpenedIds(dockableItem.config.id);
dockableItem.iconItemNode.focus();
})));
}));
}else{
this.widgetManager.closeWidget(dockableItem.config.id);
this._removeFromOpenedIds(dockableItem.config.id);
}
}else{
panelId = dockableItem.config.id + '_panel';
if(dockableItem.isOpen){
// CHANGES ---
if(this.panelManager.getPanelById(panelId)){
this.panelManager.openPanel(panelId);
} else {
// CHANGES ---
dockableItem.setPanelIndex(this._calPanelIndex());
panelConfig = dockableItem.getConfigForPanel();
this.panelManager.showPanel(panelConfig).then(lang.hitch(this, function(panel){
// CHANGES --- // panel.setPosition(panelConfig.panel.position);
aspect.after(panel, 'onClose', lang.hitch(this, function(){
dockableItem.setOpened(false);
this._removeFromOpenedIds(dockableItem.config.id);
if(dockableItem.iconItemNode){
dockableItem.iconItemNode.focus();
}
}));
}));
} // CHANGES ---