Skip to content

Commit 44f393a

Browse files
authored
Merge pull request #15 from OpenCortexIDE/investigate/linux-dropdown-menu-issue
fix: resolve Linux dropdown menu stacking context issues
2 parents 23b3fa8 + 301ee7f commit 44f393a

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/vs/base/browser/ui/menu/menubar.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Emitter, Event } from '../../../common/event.js';
1818
import { KeyCode, KeyMod, ScanCode, ScanCodeUtils } from '../../../common/keyCodes.js';
1919
import { ResolvedKeybinding } from '../../../common/keybindings.js';
2020
import { Disposable, DisposableStore, dispose, IDisposable } from '../../../common/lifecycle.js';
21-
import { isMacintosh, isWindows } from '../../../common/platform.js';
21+
import { isLinux, isMacintosh, isWindows } from '../../../common/platform.js';
2222
import * as strings from '../../../common/strings.js';
2323
import './menubar.css';
2424
import * as nls from '../../../../nls.js';
@@ -1082,9 +1082,10 @@ export class MenuBar extends Disposable {
10821082
menuHolder.style.opacity = '1';
10831083
menuHolder.style.pointerEvents = 'auto';
10841084

1085-
// On Windows, append dropdown to document.body to avoid stacking context issues
1085+
// On Windows and Linux, append dropdown to document.body to avoid stacking context issues
10861086
// where the dropdown renders behind the workbench content
1087-
if (isWindows) {
1087+
// Linux experiences the same stacking context issues as Windows
1088+
if (isWindows || isLinux) {
10881089
const window = DOM.getWindow(this.container);
10891090
window.document.body.appendChild(menuHolder);
10901091
} else {

src/vs/workbench/contrib/cortexide/browser/react/src/util/inputs.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------*/
55

66
import React, { forwardRef, ForwardRefExoticComponent, MutableRefObject, RefAttributes, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
7+
import { createPortal } from 'react-dom';
78
import { IInputBoxStyles, InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js';
89
import { defaultCheckboxStyles, defaultInputBoxStyles, defaultSelectBoxStyles } from '../../../../../../../platform/theme/browser/defaultStyles.js';
910
import { SelectBox } from '../../../../../../../base/browser/ui/selectBox/selectBox.js';
@@ -1497,8 +1498,8 @@ export const VoidCustomDropdownBox = <T extends NonNullable<any>>({
14971498
</svg>
14981499
</button>
14991500

1500-
{/* Dropdown Menu */}
1501-
{isOpen && (
1501+
{/* Dropdown Menu - Use portal to render to document.body to avoid stacking context issues on Linux */}
1502+
{isOpen && typeof document !== 'undefined' && createPortal(
15021503
<div
15031504
ref={refs.setFloating}
15041505
className="z-[10000] bg-void-bg-1 border-void-border-3 border rounded-lg shadow-lg"
@@ -1555,7 +1556,8 @@ export const VoidCustomDropdownBox = <T extends NonNullable<any>>({
15551556
})}
15561557
</div>
15571558

1558-
</div>
1559+
</div>,
1560+
document.body
15591561
)}
15601562
</div>
15611563
);

0 commit comments

Comments
 (0)