Skip to content

Commit

Permalink
Fix tab detaching behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Apr 30, 2023
1 parent c816556 commit 62fc436
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/core/src/browser/shell/tab-bars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,17 @@ export class ToolbarAwareTabBar extends ScrollableTabBar {
}

override handleEvent(event: Event): void {
if (event.target instanceof Element && this.tabBarContainer.contains(event.target)) {
super.handleEvent(event);
if (event instanceof MouseEvent) {
if (this.toolbar && this.toolbar.shouldHandleMouseEvent(event) || this.isOver(event, this.openTabsContainer)) {
// if the mouse event is over the toolbar part don't handle it.
return;
}
}
super.handleEvent(event);
}

private isOver(event: Event, element: Element): boolean {
return element && event.target instanceof Element && element.contains(event.target);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/style/tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
}

.p-TabBar-content-container {
display: block;
display: flex;
flex: 1;
position: relative; /* This is necessary for perfect-scrollbar */
}
Expand Down

0 comments on commit 62fc436

Please sign in to comment.