From bdb7353ea8980d72632679f9850f672544ee2a3b Mon Sep 17 00:00:00 2001 From: Hao-Kang Date: Wed, 6 Dec 2023 19:49:04 -0500 Subject: [PATCH] Fix toggle functionality for widgets. Co-authored-by: cccindyyyl Co-authored-by: Bojun Li Co-authored-by: Sen Feng Co-authored-by: Ariel Kwak --- packages/application/src/panelhandler.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/application/src/panelhandler.ts b/packages/application/src/panelhandler.ts index 6973d99e0b..525b62bb04 100644 --- a/packages/application/src/panelhandler.ts +++ b/packages/application/src/panelhandler.ts @@ -165,17 +165,20 @@ export class SidePanelHandler extends PanelHandler { * if there is no most recently used. */ expand(id?: string): void { - if (this._currentWidget) { - this.collapse(); - } if (id) { - this.activate(id); - } else { - const visibleWidget = this.currentWidget; - if (visibleWidget) { - this._currentWidget = visibleWidget; - this.activate(visibleWidget.id); + if (this._currentWidget && this._currentWidget.id === id) { + this.collapse(); + this.hide(); + } else { + this.collapse(); + this.hide(); + this.activate(id); + this.show(); } + } else if (this.currentWidget) { + this._currentWidget = this.currentWidget; + this.activate(this._currentWidget.id); + this.show(); } }