Skip to content

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

@erikmd

Description

@erikmd

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 #17724 (comment)

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
#17724 (comment)
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions