Skip to content

Commit 93eae54

Browse files
committed
Update tab actions visibility logic for active tabs in Modern UI
1 parent 0dac2a8 commit 93eae54

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/vs/workbench/contrib/modernUI/browser/media/tabs.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,17 +528,16 @@
528528
opacity: 1;
529529
}
530530

531-
/* When the reserved action column is always present, keep the action visible and clickable so
532-
* the column never reads as a blank gap (https://github.com/microsoft/vscode/issues/329605). */
533-
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container > .title.tab-actions-reserve-space .tabs-container > .tab:not(.sticky-compact):not(.close-action-off) > .tab-actions {
531+
/* Keep the reserved action visible and clickable on the active tab. */
532+
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container > .title.tab-actions-reserve-space .tabs-container > .tab.active:not(.sticky-compact):not(.close-action-off) > .tab-actions {
534533
pointer-events: auto;
535534
}
536535

537-
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container.active > .title.tab-actions-reserve-space .tabs-container > .tab:not(.sticky-compact):not(.close-action-off) > .tab-actions .action-label {
536+
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container.active > .title.tab-actions-reserve-space .tabs-container > .tab.active:not(.sticky-compact):not(.close-action-off) > .tab-actions .action-label {
538537
opacity: 1;
539538
}
540539

541-
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container:not(.active) > .title.tab-actions-reserve-space .tabs-container > .tab:not(.sticky-compact):not(.close-action-off):not(:hover) > .tab-actions .action-label:not(:focus) {
540+
.modern-ui-tabs.monaco-workbench .part.editor > .content .editor-group-container:not(.active) > .title.tab-actions-reserve-space .tabs-container > .tab.active:not(.sticky-compact):not(.close-action-off):not(:hover) > .tab-actions .action-label:not(:focus) {
542541
opacity: 0.5;
543542
}
544543

src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -760,32 +760,35 @@ suite('ModernUIContribution', () => {
760760
});
761761
});
762762

763-
test('persists tab actions when action space is reserved', () => {
763+
test('shows reserved tab actions only for active tabs', () => {
764764
const root = document.createElement('div');
765765
root.className = 'monaco-workbench modern-ui-tabs';
766766
document.body.appendChild(root);
767767
store.add(toDisposable(() => root.remove()));
768768

769769
const content = appendElement(appendElement(root, 'part editor'), 'content');
770-
const createTab = (groupClassName: string, titleClassName: string): HTMLElement => {
770+
const createTab = (groupClassName: string, titleClassName: string, tabClassName: string): HTMLElement => {
771771
const title = appendElement(appendElement(content, groupClassName), titleClassName);
772-
const tab = appendElement(appendElement(title, 'tabs-container'), 'tab');
772+
const tab = appendElement(appendElement(title, 'tabs-container'), tabClassName);
773773
return appendElement(appendElement(tab, 'tab-actions'), 'action-label');
774774
};
775775

776-
const reservedActive = createTab('editor-group-container active', 'title tab-actions-reserve-space');
777-
const reservedInactiveGroup = createTab('editor-group-container', 'title tab-actions-reserve-space');
778-
const transientActive = createTab('editor-group-container active', 'title');
776+
const reservedActive = createTab('editor-group-container active', 'title tab-actions-reserve-space', 'tab active');
777+
const reservedInactive = createTab('editor-group-container active', 'title tab-actions-reserve-space', 'tab');
778+
const reservedActiveInInactiveGroup = createTab('editor-group-container', 'title tab-actions-reserve-space', 'tab active');
779+
const reservedInactiveInInactiveGroup = createTab('editor-group-container', 'title tab-actions-reserve-space', 'tab');
779780

780781
const targetWindow = getWindow(root);
781782
assert.deepStrictEqual({
782783
reservedActive: { opacity: targetWindow.getComputedStyle(reservedActive).opacity, pointerEvents: targetWindow.getComputedStyle(reservedActive.parentElement!).pointerEvents },
783-
reservedInactiveGroup: { opacity: targetWindow.getComputedStyle(reservedInactiveGroup).opacity, pointerEvents: targetWindow.getComputedStyle(reservedInactiveGroup.parentElement!).pointerEvents },
784-
transientActive: { opacity: targetWindow.getComputedStyle(transientActive).opacity, pointerEvents: targetWindow.getComputedStyle(transientActive.parentElement!).pointerEvents },
784+
reservedInactive: { opacity: targetWindow.getComputedStyle(reservedInactive).opacity, pointerEvents: targetWindow.getComputedStyle(reservedInactive.parentElement!).pointerEvents },
785+
reservedActiveInInactiveGroup: { opacity: targetWindow.getComputedStyle(reservedActiveInInactiveGroup).opacity, pointerEvents: targetWindow.getComputedStyle(reservedActiveInInactiveGroup.parentElement!).pointerEvents },
786+
reservedInactiveInInactiveGroup: { opacity: targetWindow.getComputedStyle(reservedInactiveInInactiveGroup).opacity, pointerEvents: targetWindow.getComputedStyle(reservedInactiveInInactiveGroup.parentElement!).pointerEvents },
785787
}, {
786788
reservedActive: { opacity: '1', pointerEvents: 'auto' },
787-
reservedInactiveGroup: { opacity: '0.5', pointerEvents: 'auto' },
788-
transientActive: { opacity: '0', pointerEvents: 'none' },
789+
reservedInactive: { opacity: '0', pointerEvents: 'none' },
790+
reservedActiveInInactiveGroup: { opacity: '0.5', pointerEvents: 'auto' },
791+
reservedInactiveInInactiveGroup: { opacity: '0', pointerEvents: 'none' },
789792
});
790793
});
791794

0 commit comments

Comments
 (0)