浏览代码

Fix toolbar collapse status based on explicit hiding, rather than cumulative visibility.

We use .isHidden rather than .isVisible since .isVisible is affected by parent visibility. We just want to test if the direct children are explicitly hidden to decide whether to expand or collapse the toolbar. This matters, for example, if trying to fit a widget where some parent isn’t attached or visible yet (for example, a tab that is not shown).
Jason Grout 7 年之前
父节点
当前提交
78e85c3a35
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      packages/apputils/src/toolbar.ts

+ 3 - 1
packages/apputils/src/toolbar.ts

@@ -97,7 +97,9 @@ class ToolbarLayout extends PanelLayout {
   protected onFitRequest(msg: Message): void {
     super.onFitRequest(msg);
     if (this.parent!.isAttached) {
-      if (some(this.widgets, w => w.isVisible)) {
+      // If there are any widgets not explicitly hidden, expand the toolbar to
+      // accommodate them.
+      if (some(this.widgets, w => !w.isHidden)) {
         this.parent!.node.style.minHeight = 'var(--jp-private-toolbar-height)';
       } else {
         this.parent!.node.style.minHeight = '';