[Feature request] Allow to close "replace file" dialog using Esc key

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
SemiKebab
Moonbather
Moonbather
Posts: 58
Joined: 2021-05-30, 03:48

[Feature request] Allow to close "replace file" dialog using Esc key

Post by SemiKebab » 2023-07-25, 06:42

Let's say I am saving a file, but the target file already exists on my computer:
  1. In a web page, on the file link do: "right click > Save Link As..."
  2. A dialog "Enter name of file to save to..." appears.
  3. Click on "Save".
  4. As the target file already exists, a modal "foobar.ext already exists. Do you want to replace it? Yes / No (default)" appears.
Currently, to close this modal, the user has to click on "No" (or press "Enter", but I'd rather not getting used to press Enter and rely on the default behavior being the desired one)

After, the dialog "Enter name of file to save to..." is still open, and this one can be closed by pressing Esc.

By allowing to close the modal "foobar.ext already exists." by pressing Esc, the user could abort the saving much faster, just by pressing Esc twice.

User avatar
RealityRipple
Keeps coming back
Keeps coming back
Posts: 955
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by RealityRipple » 2023-07-25, 07:15

That's... not part of Pale Moon. That's part of Windows. The same "common file dialog" is used by almost every Windows application, and the functionality is the same on all of them, including that dialog not responding to "Escape".

SemiKebab
Moonbather
Moonbather
Posts: 58
Joined: 2021-05-30, 03:48

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by SemiKebab » 2023-07-25, 13:14

I was afraid it was not technically possible. I still posted the request, hoping there is some way to configure the behavior of this modal.

User avatar
Moonchild
Project founder
Project founder
Posts: 39637
Joined: 2011-08-28, 17:27
Location: Sweden

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by Moonchild » 2023-07-25, 14:14

As stated it's part of the common dialogs in the operating system; any potential configuration of it would be entirely up to the system.
The question is also: what is the behaviour supposed to be when you choose neither yes nor no to a yes or no question? You've already confirmed you want to save it in the previous step, so what is "esc" supposed to do? save what you've confirmed? completely abort the save? just go back one step? ... an argument can be made for all of those choices being correct... :think:
"Sales hates anything that can't be turned into a confident sentence." - anonymous warehouse worker
"Why debate someone you fundamentally don't trust?" - Dario Amodei
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
RealityRipple
Keeps coming back
Keeps coming back
Posts: 955
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by RealityRipple » 2023-07-25, 16:07

I'd expect it to choose the "No" option, personally - cancelling the overwrite. Escape tends to mean, "that's not what I meant/wanted".

SemiKebab
Moonbather
Moonbather
Posts: 58
Joined: 2021-05-30, 03:48

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by SemiKebab » 2023-07-25, 16:20

I thought the No choice was obvious and unambigous.. To me, the Esc key means "oh sh—, do nothing and go back!"

User avatar
Moonchild
Project founder
Project founder
Posts: 39637
Joined: 2011-08-28, 17:27
Location: Sweden

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by Moonchild » 2023-07-25, 17:26

It isn't clear. "go back" to what - to the save dialog, cancelling the overwite only and returning to saving? Or to the host application, cancelling the entire download?
To me that choice is not intuitively clear.

Either way, we're not in control.
"Sales hates anything that can't be turned into a confident sentence." - anonymous warehouse worker
"Why debate someone you fundamentally don't trust?" - Dario Amodei
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Kerebron
Fanatic
Fanatic
Posts: 129
Joined: 2016-12-04, 22:01

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by Kerebron » 2023-07-25, 19:59

SemiKebab - the easiest solution would be making a macro with needed keystroke sequence. If your mouse/keyboard software doesn't have macro capability, you can use some universal solution, like AutoHotkey, for example.
Now, here, you see, it takes all the running you can do, to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that!

User avatar
therube
Board Warrior
Board Warrior
Posts: 1776
Joined: 2018-06-08, 17:02

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by therube » 2023-07-25, 20:13

Depending on the particular dialog, it may be ESCable.

This one, generated via Winmerge, is.
.
Winmerge Modal Dialog is ESCable.png
You do not have the required permissions to view the files attached to this post.

Keiji
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2017-09-27, 19:31

Re: [Feature request] Allow to close "replace file" dialog using Esc key

Post by Keiji » 2023-08-02, 07:06

SemiKebab wrote:
2023-07-25, 06:42
As the target file already exists, a modal "foobar.ext already exists. Do you want to replace it? Yes / No (default)" appears.
Currently, to close this modal, the user has to click on "No" (or press "Enter", but I'd rather not getting used to press Enter and rely on the default behavior being the desired one)
I'll agree with you that pressing Escape on this particular window really should do the same as pressing No. But indeed, that's part of Windows, and not something that can be easily changed.


=====
I actually did find a - somewhat hacky - way to change this in a piece of Windows software I wrote myself a while back. Out of all the possible MsgBox styles you can create on Windows, it's only the Yes/No (without Cancel) style where Escape does nothing.* More modern versions of the API to show a MsgBox allow you to overwrite the button names. So instead of a Yes/No MsgBox, I showed an OK/Cancel MsgBox, but renamed OK to Yes and Cancel to No. Which results in Escape working! If this particular "file already exists" dialog is shown by Pale Moon and not by Windows Explorer (I'm a bit rusty on whether the OS "save as" box displays its own overwrite confirmation or not), then it could be a potential way for Pale Moon to implement this - but I won't be calling for it myself as it is a hack and Moonchild has already stated he thinks it's not clear what Escape should do there, even if I personally do think it should do the same as "No".

*And I believe the original reason behind this design is that "Escape" should always mean "Cancel" and this box is intended for situations where there is no ability to cancel - for example, "this program has crashed, do you want to restart it" - you could say "yes, (restart it)" or "no, (just exit)" but there's no way to go back to the previous state where the program hadn't yet crashed - therefore it is indeed meaningless to answer with "Cancel", and making Escape be "No" here but "Cancel" elsewhere could be confusing. But the real fallacy is that 99% of the Yes/No MsgBox's displayed these days are really OK/Cancel ones, it's just that when we ask the question in English, a Yes/No question sounds more intuitive regardless... so that's what we've been using. If anything, this actually gives weight to my hacky solution, where I display an OK/Cancel box but rename the buttons to Yes/No. Also, these days, it's just generally advised against to even use Yes/No questions any more: the question should be phrased similar to "here is the situation, what do you want to do about it", and the answers be specific verbs: so, in my example, "this program has crashed" => "restart it" / "just exit" or indeed in the original case, "this file already exists" => "replace it" / "go back".

That ended up being a lot more ramble than I anticipated, but I hope it's useful information to someone.
=====


In case this helps you, though, and you weren't already aware: You can also press the [n] letter key to say No.