Skip to content

Commit b31130c

Browse files
committed
Revert "fixes microsoft#93415"
This reverts commit 867f017.
1 parent be61b7d commit b31130c

5 files changed

Lines changed: 10 additions & 32 deletions

File tree

src/vs/base/browser/ui/contextview/contextview.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
.context-view {
7-
position: fixed;
7+
position: absolute;
88
z-index: 2500;
99
}

src/vs/base/browser/ui/contextview/contextview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface IDelegate {
3838
}
3939

4040
export interface IContextViewProvider {
41-
showContextView(delegate: IDelegate, container?: HTMLElement): void;
41+
showContextView(delegate: IDelegate): void;
4242
hideContextView(): void;
4343
layout(): void;
4444
}
@@ -255,8 +255,9 @@ export class ContextView extends Disposable {
255255
DOM.addClass(this.view, anchorPosition === AnchorPosition.BELOW ? 'bottom' : 'top');
256256
DOM.addClass(this.view, anchorAlignment === AnchorAlignment.LEFT ? 'left' : 'right');
257257

258-
this.view.style.top = `${top}px`;
259-
this.view.style.left = `${left}px`;
258+
const containerPosition = DOM.getDomNodePagePosition(this.container!);
259+
this.view.style.top = `${top - containerPosition.top}px`;
260+
this.view.style.left = `${left - containerPosition.left}px`;
260261
this.view.style.width = 'initial';
261262
}
262263

src/vs/base/browser/ui/selectBox/selectBox.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@
66
.monaco-select-box {
77
width: 100%;
88
}
9-
10-
.monaco-select-box-dropdown-container {
11-
font-size: 13px;
12-
font-weight: normal;
13-
text-transform: none;
14-
}

src/vs/base/browser/ui/selectBox/selectBoxCustom.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
8989
private _isVisible: boolean;
9090
private selectBoxOptions: ISelectBoxOptions;
9191
private selectElement: HTMLSelectElement;
92-
private container?: HTMLElement;
9392
private options: ISelectOptionItem[] = [];
9493
private selected: number;
9594
private readonly _onDidSelect: Emitter<ISelectData>;
@@ -308,7 +307,6 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
308307
}
309308

310309
public render(container: HTMLElement): void {
311-
this.container = container;
312310
dom.addClass(container, 'select-container');
313311
container.appendChild(this.selectElement);
314312
this.applyStyles();
@@ -444,7 +442,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
444442
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
445443
},
446444
anchorPosition: this._dropDownPosition
447-
}, this.container);
445+
});
448446

449447
// Hide so we can relay out
450448
this._isVisible = true;
@@ -459,7 +457,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
459457
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
460458
},
461459
anchorPosition: this._dropDownPosition
462-
}, this.container);
460+
});
463461

464462
// Track initial selection the case user escape, blur
465463
this._currentSelection = this.selected;

src/vs/platform/contextview/browser/contextViewService.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ export class ContextViewService extends Disposable implements IContextViewServic
1212
_serviceBrand: undefined;
1313

1414
private contextView: ContextView;
15-
private container: HTMLElement;
1615

1716
constructor(
1817
@ILayoutService readonly layoutService: ILayoutService
1918
) {
2019
super();
2120

22-
this.container = layoutService.container;
23-
this.contextView = this._register(new ContextView(this.container));
21+
this.contextView = this._register(new ContextView(layoutService.container));
2422
this.layout();
2523

2624
this._register(layoutService.onLayout(() => this.layout()));
@@ -32,20 +30,7 @@ export class ContextViewService extends Disposable implements IContextViewServic
3230
this.contextView.setContainer(container);
3331
}
3432

35-
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): void {
36-
37-
if (container) {
38-
if (container !== this.container) {
39-
this.container = container;
40-
this.setContainer(container);
41-
}
42-
} else {
43-
if (this.container !== this.layoutService.container) {
44-
this.container = this.layoutService.container;
45-
this.setContainer(this.container);
46-
}
47-
}
48-
33+
showContextView(delegate: IContextViewDelegate): void {
4934
this.contextView.show(delegate);
5035
}
5136

@@ -56,4 +41,4 @@ export class ContextViewService extends Disposable implements IContextViewServic
5641
hideContextView(data?: any): void {
5742
this.contextView.hide(data);
5843
}
59-
}
44+
}

0 commit comments

Comments
 (0)