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

ui: Confirmation on exit from exec as long as socket has been opened #19985

Conversation

philrenaud
Copy link
Contributor

Resolves #19849

In an exec window context, navigating away from the page is not possible by in-page links, as there are none (besides Documentation, which opens in a new tab). Otherwise, closing the window by clicking exit, or using a keyboard shortcut like ctrl+w, ctrl+q, etc. is the most common method.

Unfortunately, some of those keyboard shortcuts are also used for in-terminal activity (like ctrl+w to delete a word in bash, or split a terminal in vim), and users' muscle memory may cause them to close a window, losing time and context along the way.

This PR adds a beforeunload handler to the exec terminal component, triggered whenever a socket is open and the user does an action that would close the parent tab/window. It will add a prompt asking the user if they meant to close it, and if they hit cancel or escape, it will bring their context back to the cursor in the terminal. Otherwise, the window will be closed.

@philrenaud philrenaud self-assigned this Feb 14, 2024
@philrenaud philrenaud linked an issue Feb 14, 2024 that may be closed by this pull request
@philrenaud philrenaud force-pushed the 19849-ctrl+w-in-exec-in-web-ui-closes-the-window-without-prompting branch from b2863f1 to 50d598b Compare February 14, 2024 17:32
@philrenaud philrenaud force-pushed the 19849-ctrl+w-in-exec-in-web-ui-closes-the-window-without-prompting branch from 50d598b to f918170 Compare February 14, 2024 17:41
Copy link

github-actions bot commented Feb 14, 2024

Ember Test Audit comparison

main f918170 change
passes 1548 1548 0
failures 0 0 0
flaky 0 0 0
duration 11m 10s 108ms 11m 13s 129ms +03s 021ms

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⌨️

@philrenaud philrenaud added the backport/1.7.x backport to 1.7.x release line label Feb 15, 2024
@philrenaud philrenaud merged commit c1cbc39 into main Feb 15, 2024
15 checks passed
@philrenaud philrenaud deleted the 19849-ctrl+w-in-exec-in-web-ui-closes-the-window-without-prompting branch February 15, 2024 16:52
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.7.x backport to 1.7.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+W in Exec in web UI closes the window without prompting
2 participants