gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

Please add some onbeforeunload handler in the workspace view to avoid unexpected tab exit

Open erikmd opened this issue 2 years ago • 12 comments

Is your feature request related to a problem? Please describe

Currently using Gitpod in the browser is annoying when (like me) the Ctrl+w shortcut is wired in my hands, both in emacs and shell context…

Indeed, this closes the window.

Beyond my particular case, I believe many users also get annoyed when they mistype Ctrl+w and close their workspace tab.

Describe the behaviour you'd like

As suggested in https://github.com/gitpod-io/gitpod/issues/17724#issuecomment-1633234723

I would like to request some closing confirmation in all Gitpod browser editors, → with some JS code such as window.onbeforeunload = function(e) {e.preventDefault(); return false;}

and just undo this setting at workspace stop (e.g. gp stop, leading to page Stopped / Go-to-Dashboard) → with some JS code such as window.onbeforeunload = null;

Describe alternatives you've considered

One might otherwise try to disable the Ctrl+w shorcut in the browser, however as noted in https://github.com/gitpod-io/gitpod/issues/17724#issuecomment-1633223284 this is neither browser-cross-compatible nor builtin in general, one needs to install 3rd-party extensions to do this.

So, adding an onbeforeunload handler looks way simpler, and fully works.

Additional context

N/A

erikmd avatar Aug 02 '23 15:08 erikmd

VS Code already does it by default. If you want to have it always please change your settings "application.confirmExit": "always" otherwise it happens only for dirty changes.

akosyakov avatar Aug 02 '23 16:08 akosyakov

Dear @akosyakov,

Sorry but I'm not a VS code user 😅

I only use Gitpod's Browser Terminal (currently in beta IIUC) as a Gitpod IDE.

Is this confirmExit option available as well for all Gitpod web editors (other than VS code)?

erikmd avatar Aug 02 '23 16:08 erikmd

So I believe you could reopen this issue :)

erikmd avatar Aug 02 '23 19:08 erikmd

Sorry, yes makes sense, we should support something like that there.

akosyakov avatar Aug 03 '23 05:08 akosyakov

Dear @akosyakov, do you know:

  1. what could be the ETA for this improvement? (which will be important for Browser Terminal users IMHO)
  2. did you already set a date for ending the Beta/releasing the Browser Terminal editor?

Sorry if this is not the proper place to ask…

erikmd avatar Aug 18 '23 15:08 erikmd

Dear Gitpod maintainers,

  1. did you already set a date for ending the Beta/releasing the Browser Terminal editor?

I guess you already replied to this one, thanks for the release 👍 :exclamation: :pray:

What about the second question?

  1. what could be the ETA for this improvement #18416 ? (which will be important for Browser Terminal users IMHO)

Cc @loujaybee @akosyakov

Cheers, Erik

erikmd avatar Sep 06 '23 13:09 erikmd

Thanks @loujaybee for adding this label :)

— Actually I noticed the issue with emacs, so maybe it could be tagged editor: emacs as well?

Thanks for your time!

erikmd avatar Sep 06 '23 21:09 erikmd

Dear @loujaybee,

Do you think this would help if I'd try to open a PR to implement this small (but very useful IMHO) enhancement?

Of course, I might need a bit of guidance at first, to spot the main components to change…

erikmd avatar Mar 06 '24 00:03 erikmd

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 04 '24 15:06 github-actions[bot]

Hi! Please do not close, I do think this feature request is worth implementing.

erikmd avatar Jun 05 '24 19:06 erikmd

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 04 '24 15:09 github-actions[bot]

Please do not close, this feature request should definitely be addressed! Feel free to start implementing it, otherwise I may try to open a PR in a couple of weeks.

erikmd avatar Sep 08 '24 09:09 erikmd