mirror of
https://github.com/zen-browser/desktop.git
synced 2026-09-01 19:23:34 +00:00
gh-15182: Fix tab changing when handling tab close when group collapses (gh-15183)
This commit is contained in:
@@ -160,7 +160,9 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
if (groupIndex < 0) {
|
||||
return;
|
||||
}
|
||||
this.removeTabFromGroup(tab, groupIndex, { forUnsplit: true });
|
||||
this.removeTabFromGroup(tab, groupIndex, {
|
||||
forUnsplit: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,16 +205,21 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
* @param {object} [options={}] - Additional options.
|
||||
* @param {boolean} [options.forUnsplit=false] - Whether the removal is for unsplitting.
|
||||
* @param {boolean} [options.dontRebuildGrid=false] - Whether to skip rebuilding the grid layout.
|
||||
* @param {boolean} [options.changeTab=true] - Whether to change the selected tab.
|
||||
* @param {boolean} [options.changeTab=undefined] - Whether to change the selected tab. If left unspecified,
|
||||
* change the selected tab only if the current view is the group the removed tab was in.
|
||||
*/
|
||||
removeTabFromGroup(
|
||||
tab,
|
||||
groupIndex = undefined,
|
||||
{ forUnsplit = false, dontRebuildGrid = false, changeTab = true } = {}
|
||||
{ forUnsplit = false, dontRebuildGrid = false, changeTab = undefined } = {}
|
||||
) {
|
||||
if (typeof groupIndex === "undefined") {
|
||||
groupIndex = this._data.findIndex(group => group.tabs.includes(tab));
|
||||
}
|
||||
|
||||
if (typeof changeTab === "undefined") {
|
||||
changeTab = groupIndex === this.currentView;
|
||||
}
|
||||
// If groupIndex === -1, so `this._data.findIndex` couldn't find the split group
|
||||
if (groupIndex < 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user