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

Prevent Cmd/Ctrl+W from closing tab in Codespaces online editor (still not fixed) #197731

Closed
Arkemlar opened this issue Nov 8, 2023 · 7 comments
Labels
feature-request Request for new features or functionality github-codespaces keybindings VS Code keybinding issues web Issues related to running VSCode in the web

Comments

@Arkemlar
Copy link

Arkemlar commented Nov 8, 2023

When I press cmd+w (on Mac) then whole browser tab gets closed.

I found similar issue [link 1] that marked as duplicate of this issue [link 2] BUT neither of them solving it.

As mentioned in [link 2] I set up window.confirmBeforeClose setting (to option always) but it changed nothing - tab just keeps immideately closed.

THEN I tested idea prompted in [link 1] about adding window.onbeforeunload, I typed into browser tab's console this line:

window.onbeforeunload = () => true;

And NOW browser asked me about closing tab, just like it normally do in other web sites.
But it looks like vscode itself has some event handlers on that case and when I pressed cmd+w, I seen browser's prompt (ie Do your really want to leave the page) and also noticed how console has flooded with errors and finally an error window from vscode displayed which told me that vscode broken and I must reload the tab.

So what do we have as result.
Solution with using window.confirmBeforeClose setting - not works and it actually not even tries to work. Because if it would, then it surely must use something similar to window.onbeforeunload = () => true; that prevents browser from closing tab.
Both referenced issues relate to this one, but are not duplicates since they are closed long time ago and not solved the problem.

Version: 1.84.1
Commit: 2b35e1e
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0
Embedder: codespaces

@bpasero bpasero added feature-request Request for new features or functionality web Issues related to running VSCode in the web github-codespaces keybindings VS Code keybinding issues labels Nov 8, 2023
@bpasero bpasero removed their assignment Nov 8, 2023
@bpasero
Copy link
Member

bpasero commented Nov 8, 2023

As a workaround: fullscreen the page or install it as PWA and keybindings should work better.

@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone Nov 8, 2023
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

SusiesuS added a commit to SusiesuS/vscode that referenced this issue Dec 6, 2023
@VSCodeTriageBot
Copy link
Collaborator

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@VSCodeTriageBot
Copy link
Collaborator

🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@VSCodeTriageBot VSCodeTriageBot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@r-blankenship
Copy link

Installing as a PWA (Progressive Web App) fixed the issue for me.

  1. Go to the URL bar in Chrome
  2. Look for the Download Icon (it is a computer monitor with a downward arrow, next to the Star)
  3. Accept the download

Screenshot from 2024-05-18 19-38-24

@djbrown
Copy link

djbrown commented May 27, 2024

Not available for Firefox though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality github-codespaces keybindings VS Code keybinding issues web Issues related to running VSCode in the web
Projects
None yet
Development

No branches or pull requests

5 participants