Open
Description
The removePanel method of the <bit-tabs>
component's view model is called for each tab when the entire set of tabs is removed. If the removed tab was active, the current implementation makes the first tab active. This presents a problem if the tabs contain complex logic because all kinds of undesirable behavior could ensue as each tab becomes temporarily activated.
Since the removed
event of the parent is called before the child, this could be fixed by setting a flag on the parent when it's being removed that would prevent the panels from being made active.
if(panels.length && !this.attr('removing')){
this.makeActive(panels[0]);
} else {
this.removeAttr("active");
}
can.Component.extend({
tag: "bit-tabs",
template: tabsStache,
scope: BitTabsVM,
events: {
removed() {
this.viewModel.attr("removing", true);
}
}
});
Thoughts? Is this event order always going to be the case?