Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aux window does not work in Firefox #213645

Closed
jrieken opened this issue May 28, 2024 · 12 comments · Fixed by #213769
Closed

Aux window does not work in Firefox #213645

jrieken opened this issue May 28, 2024 · 12 comments · Fixed by #213769
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member firefox Issues running VSCode in Web on Firefox insiders-released Patch has been released in VS Code Insiders verified Verification succeeded web Issues related to running VSCode in the web workbench-auxwindow Issues related to use of auxiliary ("floating") windows.
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented May 28, 2024

Testing #213597

  • linux VM
  • FF browser 122.x
  • F1 > Report Issue
  • 🐛 only a blank window opens, the main window shows the error below in its console
Uncaught (in promise) TypeError: ct.document is undefined
    m dom.ts:1295
    ot dom.ts:1301
    xe dom.ts:1357
    u button.ts:172
    o issue.ts:88
    y issueReporterService.ts:31
    o instantiationService.ts:162
    createInstance instantiationService.ts:128
    openAuxIssueReporter issueFormService.ts:121

Screenshot 2024-05-28 at 11 49 08
@jrieken
Copy link
Member Author

jrieken commented May 28, 2024

@bpasero This might be a general FF issue, moving an editor into a new window also fails

@jrieken
Copy link
Member Author

jrieken commented May 28, 2024

The same happens with latest FF (126) on macOS

@bpasero bpasero added confirmed Issue has been confirmed by VS Code Team member firefox Issues running VSCode in Web on Firefox workbench-auxwindow Issues related to use of auxiliary ("floating") windows. web Issues related to running VSCode in the web labels May 28, 2024
@bpasero
Copy link
Member

bpasero commented May 28, 2024

Wow, this is really bad and I am not sure something we can actually fix with our current assumptions. As it turns out xy instanceof HTMLElement returns false on Firefox when an element is inside the floating window, while it is totally fine in other browsers. For floating windows, the first assertion that breaks is this one:

assertType(container instanceof HTMLElement);

We have code in place to mitigate this for certain types such as events:

export function isMouseEvent(e: unknown): e is MouseEvent {
// eslint-disable-next-line no-restricted-syntax
return e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;
}

But we never wanted to adopt it for DOM elements because they are actually often created in the main window and only later moved to the floating window.

I wonder why Firefox behaves different here, but its possible that they actually behave more correct than others 🤔

@bpasero
Copy link
Member

bpasero commented May 28, 2024

Just to clarify: maybe its easier to fix for the issue reporter because that one is more scoped to a smaller set of problems. We could start adding those utility methods for the issue reporter and then see whats remaining for the floating windows.

But I think adopting this through our code is quite a thing, and we would need methods for basically each kind of HTML element + lint rules to prevent this from being called...

@justschen
Copy link
Contributor

@bpasero I'm assuming it would be something along the lines of:

export function isHTMLElement(e: unknown): e is MouseEvent {
	// eslint-disable-next-line no-restricted-syntax
	return e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;
}

export function isTextAreaElement(e: unknown): e is HTMLTextAreaElement {
	// eslint-disable-next-line no-restricted-syntax
	return e instanceof HTMLTextAreaElement || e instanceof getWindow(e as Node).HTMLTextAreaElement;
}

....

how would this be used in the context of the issue reporter since I'm just calling this.auxiliaryWindowService.open()....?

@bpasero
Copy link
Member

bpasero commented May 28, 2024

Yeah you are likely using a dom.ts or similar utility function that does an instanceof check, we would need to adopt it gradually through the usages.

@justschen
Copy link
Contributor

justschen commented May 28, 2024

gotcha, I see that now. I'l add the ones I am checking in my UI to dom.ts for now and we can see what other actions we need later if it works nicely with the issue reporter. if you'd like help with other non-issue reporter scenarios, let me know as well!

@justschen
Copy link
Contributor

to clarify, would something like this be a cause of this as well?

<HTMLInputElement>this.getElementById('issue-title')

@bpasero
Copy link
Member

bpasero commented May 28, 2024

I think there are actually more issues, I did some testing with most instanceof checks doing it the other way and the issue reporter is not styled:

image

And floating windows open and then quickly close again :-/

@justschen
Copy link
Contributor

:( maybe just for firefox for now I'll disable the aux window issue reporter this while we investigate

@bpasero
Copy link
Member

bpasero commented May 28, 2024

I am actually wondering if on Firefox its just not possible to create DOM nodes in the main window and append them into the child window, because I do not see any DOM nodes appearing in the child window.

We explicitly decided against creating DOM nodes using the target window because it complicates instance of checks.

Anyway, as a mitigation I would disable the window based issue reporter when in Firefox unless we figure out the root cause.

@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label May 29, 2024
@bpasero bpasero added this to the May 2024 milestone May 29, 2024
@bpasero bpasero changed the title Issue Reporter doesn't work on FF Aux window does not work in Firefox May 29, 2024
@bpasero
Copy link
Member

bpasero commented May 29, 2024

I found a way 🚀 🎸

@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels May 29, 2024
@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label May 29, 2024
@microsoft microsoft locked and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member firefox Issues running VSCode in Web on Firefox insiders-released Patch has been released in VS Code Insiders verified Verification succeeded web Issues related to running VSCode in the web workbench-auxwindow Issues related to use of auxiliary ("floating") windows.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants