vimium-c icon indicating copy to clipboard operation
vimium-c copied to clipboard

Confirmation option on destructive actions

Open bristi opened this issue 2 years ago • 1 comments

What command or commands

Ask for confirmation before performing a destructive action. Destructive actions include

  • Closing tab(s) - x
  • Reloading or reopening tab(s) - r, R, <a-r>, <a-s-r>

Motivation is that work may be lost if focus on some text input field is suddenly lost and user keeps typing. For a large number of websites there is no saved session to get back to if the page is suddenly reloaded or closed. This loss of focus can happen for all sorts of reasons, including user error, website or browser malfunction and so on, so trying to safeguard against it seem futile. It may even be that the user only thought they clicked in a text field but actually did not.

One could argue that following links are also potentially dangerous, perhaps especially the ]] and [[ commands since they do not require a follow-up action. I have chosen not to include such actions in this feature request.

How should a feature do

When a user wants to perform a destructive action a standard browser confirmation dialog comes up;

  • A descriptive text of action to be performed, eg "You are about to close 6 tab(s). Continue?"
  • Buttons "Cancel" and "Ok"
  • Button Cancel is highlighted, so if user presses Enter nothing happens.
  • User may perform Ok button press by navigating to button with right or left arrow key and then press enter or by using keyboard shortcut alt-o.

This should be implemented as an optional feature in the plugin settings so users can decide themselves whether this is needed.

I would propose starting off with a single option "Require confirmation before closing or reloading tabs" and then see if there is a need for more granularity later.

Browser and OS

  • Browser name: Google Chrome 109.0.5414.74 (Official Build) (64-bit)
  • OS name: Linux

bristi avatar Jan 20 '23 10:01 bristi

Hello, a latest version of Vimium C supports a new command named confirm:

You may use map xxx confirm ask="Are-you-sure-to-close-tabs?" minRepeat=2 $then="removeTab" to remove one tab directly while show a confirmation dialog before removing at least 2 tabs.

The value of $then parameter can be a command name or a mapped key sequence in your key mappings.

gdh1995 avatar Jun 15 '23 15:06 gdh1995