mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fix the dropdown menu width logic (#20165)
* fix the dropdown menu width logic * comment
This commit is contained in:
@@ -90,6 +90,7 @@ export class Dropdown extends Disposable implements IListVirtualDelegate<string>
|
|||||||
private _onFocus = this._register(new Emitter<void>());
|
private _onFocus = this._register(new Emitter<void>());
|
||||||
public onFocus: Event<void> = this._onFocus.event;
|
public onFocus: Event<void> = this._onFocus.event;
|
||||||
private readonly _widthControlElement: HTMLElement;
|
private readonly _widthControlElement: HTMLElement;
|
||||||
|
private readonly _widthControlElementContainer: HTMLElement;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
@@ -99,9 +100,12 @@ export class Dropdown extends Disposable implements IListVirtualDelegate<string>
|
|||||||
super();
|
super();
|
||||||
this._options = opt || Object.create(null);
|
this._options = opt || Object.create(null);
|
||||||
mixin(this._options, defaults, false);
|
mixin(this._options, defaults, false);
|
||||||
this._widthControlElement = DOM.append(container, document.createElement('span'));
|
// Set up the width measure control using the same classes and structure as the context menu to get the accurate width measurement.
|
||||||
this._widthControlElement.classList.add('monaco-dropdown-width-control-element');
|
this._widthControlElementContainer = DOM.append(container, document.createElement('div'));
|
||||||
this._widthControlElement.setAttribute('aria-hidden', 'true');
|
this._widthControlElementContainer.classList.add('monaco-dropdown-width-control-element', 'context-view', 'fixed');
|
||||||
|
this._widthControlElementContainer.setAttribute('aria-hidden', 'true');
|
||||||
|
this._widthControlElement = DOM.append(this._widthControlElementContainer, document.createElement('span'));
|
||||||
|
this._widthControlElement.classList.add('editable-drop-option-text');
|
||||||
|
|
||||||
this._el = DOM.append(container, DOM.$('.monaco-dropdown'));
|
this._el = DOM.append(container, DOM.$('.monaco-dropdown'));
|
||||||
this._el.style.width = '100%';
|
this._el.style.width = '100%';
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
.monaco-dropdown-width-control-element {
|
.monaco-dropdown-width-control-element {
|
||||||
position: absolute;
|
position: absolute !important;
|
||||||
left: -10000px;
|
left: -10000px !important;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user