-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aux window - hopefully fix contextview issue
- Loading branch information
Showing
2 changed files
with
25 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,29 +136,33 @@ export class ContextView extends Disposable { | |
|
||
private container: HTMLElement | null = null; | ||
private view: HTMLElement; | ||
private useFixedPosition: boolean; | ||
private useShadowDOM: boolean; | ||
private useFixedPosition = false; | ||
private useShadowDOM = false; | ||
private delegate: IDelegate | null = null; | ||
private toDisposeOnClean: IDisposable = Disposable.None; | ||
private toDisposeOnSetContainer: IDisposable = Disposable.None; | ||
private shadowRoot: ShadowRoot | null = null; | ||
private shadowRootHostElement: HTMLElement | null = null; | ||
|
||
constructor(container: HTMLElement | null, domPosition: ContextViewDOMPosition) { | ||
constructor(container: HTMLElement, domPosition: ContextViewDOMPosition) { | ||
super(); | ||
|
||
this.view = DOM.$('.context-view'); | ||
this.useFixedPosition = false; | ||
this.useShadowDOM = false; | ||
|
||
DOM.hide(this.view); | ||
|
||
this.setContainer(container, domPosition); | ||
|
||
this._register(toDisposable(() => this.setContainer(null, ContextViewDOMPosition.ABSOLUTE))); | ||
} | ||
|
||
setContainer(container: HTMLElement | null, domPosition: ContextViewDOMPosition): void { | ||
this.useFixedPosition = domPosition !== ContextViewDOMPosition.ABSOLUTE; | ||
const usedShadowDOM = this.useShadowDOM; | ||
this.useShadowDOM = domPosition === ContextViewDOMPosition.FIXED_SHADOW; | ||
|
||
if (container === this.container && usedShadowDOM !== this.useShadowDOM) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bpasero
Author
Member
|
||
return; // container is the same and now shadow DOM usage has changed | ||
} | ||
|
||
if (this.container) { | ||
this.toDisposeOnSetContainer.dispose(); | ||
|
||
|
@@ -173,12 +177,10 @@ export class ContextView extends Disposable { | |
|
||
this.container = null; | ||
} | ||
|
||
if (container) { | ||
this.container = container; | ||
|
||
this.useFixedPosition = domPosition !== ContextViewDOMPosition.ABSOLUTE; | ||
this.useShadowDOM = domPosition === ContextViewDOMPosition.FIXED_SHADOW; | ||
|
||
if (this.useShadowDOM) { | ||
this.shadowRootHostElement = DOM.$('.shadow-root-host'); | ||
this.container.appendChild(this.shadowRootHostElement); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this seems to force some cases to return early since
useShadowDom
changed, so the action widget does not get removed correctly fromshadow-root
(ref. #198881)This happens in the following steps:
(note: this flow is not happening on MacOS because when right clicking, it uses the native context menu, vs. built in context menu from VS Code)
Does not happen when refactoring using
CtrlCmd + Shift + R
. I suspect the above error happens becauseuseShadowRoot
is set totrue
via line 160 when the context menu is opened, is observed astrue
when the action widget is opened, sees the change (this.useShadowDom is changed tofalse
), and returns early.