Skip to content

Commit

Permalink
Do not set the dockpanel as parent of the tabbar (#606)
Browse files Browse the repository at this point in the history
* Add a focusTrackable attribute to Widget, to disable the focusTracker

* Add tests on trackable attribute

* Revert "Add tests on trackable attribute"

This reverts commit 9324ea6.

* Revert "Add a focusTrackable attribute to Widget, to disable the focusTracker"

This reverts commit a43945d.

* Attach the tabbar to the dock panel without setting its parent

* Add test on tabbar not parented to docklayout

* Add comment in test
  • Loading branch information
brichet authored Jul 19, 2023
1 parent 5f46249 commit adb6838
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/widgets/src/docklayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1128,9 +1128,8 @@ export class DockLayout extends Layout {
// Enforce necessary tab bar behavior.
tabBar.orientation = 'horizontal';

// Reparent and attach the tab bar to the parent if possible.
// Attach the tab bar to the parent if possible.
if (this.parent) {
tabBar.parent = this.parent;
this.attachWidget(tabBar);
}

Expand Down
10 changes: 10 additions & 0 deletions packages/widgets/tests/src/dockpanel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ describe('@lumino/widgets', () => {
let panel = new DockPanel();
expect(panel.hasClass('lm-DockPanel')).to.equal(true);
});

it('should not have tabbar as child', () => {
let panel = new DockPanel();
// Adding a widget in the dock panel adds the DOM of a TabBar, but the TabBar
// widget should not be a in the children list of the DockPanel widget.
panel.addWidget(new Widget());
for (const tabBar of panel.tabBars()) {
expect(panel.contains(tabBar)).to.be.false;
}
});
});

describe('#dispose()', () => {
Expand Down

0 comments on commit adb6838

Please sign in to comment.