Ask for confirmation of window close if form has been edited (prompt users before Quit)
Categories
(Firefox :: Session Restore, enhancement, P3)
Tracking
()
People
(Reporter: hp, Unassigned)
References
Details
(Keywords: polish, Whiteboard: [FIX])
Attachments
(2 files, 4 obsolete files)
(deleted),
patch
|
law
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
Comment 1•24 years ago
|
||
Comment 5•24 years ago
|
||
Comment 7•24 years ago
|
||
Comment 10•24 years ago
|
||
Comment 11•24 years ago
|
||
Comment 12•24 years ago
|
||
Comment 13•24 years ago
|
||
Comment 14•24 years ago
|
||
Comment 15•24 years ago
|
||
Comment 17•23 years ago
|
||
Comment 18•23 years ago
|
||
Comment 19•23 years ago
|
||
Updated•23 years ago
|
Comment 20•23 years ago
|
||
Comment 21•23 years ago
|
||
Comment 22•23 years ago
|
||
Comment 23•22 years ago
|
||
Comment 24•22 years ago
|
||
Comment 25•22 years ago
|
||
Comment 26•22 years ago
|
||
Comment 27•22 years ago
|
||
Comment 28•22 years ago
|
||
Comment 31•22 years ago
|
||
Comment 32•22 years ago
|
||
Comment 33•22 years ago
|
||
Comment 34•22 years ago
|
||
Comment 35•22 years ago
|
||
Comment 36•22 years ago
|
||
Comment 37•22 years ago
|
||
Comment 38•22 years ago
|
||
Comment 39•22 years ago
|
||
Comment 40•22 years ago
|
||
Comment 41•22 years ago
|
||
Comment 42•22 years ago
|
||
Comment 43•22 years ago
|
||
Comment 44•22 years ago
|
||
Comment 45•22 years ago
|
||
Comment 46•22 years ago
|
||
Comment 47•22 years ago
|
||
Comment 48•22 years ago
|
||
Comment 49•22 years ago
|
||
Comment 50•22 years ago
|
||
Comment 51•22 years ago
|
||
Comment 52•22 years ago
|
||
Comment 53•22 years ago
|
||
Comment 54•22 years ago
|
||
Comment 55•22 years ago
|
||
Comment 56•22 years ago
|
||
Comment 57•22 years ago
|
||
Comment 58•22 years ago
|
||
Comment 59•22 years ago
|
||
Comment 60•22 years ago
|
||
Comment 61•22 years ago
|
||
Comment 62•22 years ago
|
||
Comment 63•22 years ago
|
||
Comment 64•21 years ago
|
||
Comment 65•19 years ago
|
||
Comment 66•19 years ago
|
||
Comment 67•19 years ago
|
||
Comment 68•19 years ago
|
||
Comment 69•19 years ago
|
||
Comment 70•19 years ago
|
||
Comment 71•19 years ago
|
||
Comment 72•19 years ago
|
||
Comment 73•18 years ago
|
||
Updated•18 years ago
|
Comment 74•18 years ago
|
||
Comment 75•16 years ago
|
||
Comment 76•16 years ago
|
||
Comment 77•16 years ago
|
||
Comment 79•16 years ago
|
||
Comment 80•16 years ago
|
||
Comment 81•16 years ago
|
||
Comment 82•15 years ago
|
||
Comment 84•15 years ago
|
||
Updated•15 years ago
|
Comment 85•15 years ago
|
||
Comment 88•14 years ago
|
||
Comment 90•13 years ago
|
||
Comment 91•13 years ago
|
||
Comment 93•12 years ago
|
||
Comment 94•11 years ago
|
||
Updated•11 years ago
|
Comment 95•10 years ago
|
||
Updated•9 years ago
|
Comment 98•4 years ago
|
||
Hello! I have tried to reproduce this issue on Ubuntu 20 with Firefox 87.0a1(2021-02-16), 85.0.2 and 86.0b9. I will mark this issue as RESOLVED -> WORKSFORME. If this issue is still reproducing please feel free to reopen it and change it's status.
Thank you!
Comment 99•4 years ago
|
||
The key to close the application is not Alt-Q
anymore but Ctrl-Q
on Linux (1, 2). Tests e.g. on https://bugzilla.mozilla.org/query.cgi?format=advanced shows Ctrl-Q quits the application even if the user entered text into the form fields.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 100•3 years ago
|
||
As far as I can tell, our current behavior here matches (or is maybe even better-at-preserving-data than) other browsers.
Specifically, here's what I see from other browsers:
- Safari 15.2 on macOS: Cmd+W and Cmd+Q close tab or quit on Safari, regardless of whether you have data entered into a form field. (Comment 93 suggests that Safari might have warned at that time, but they don't now.)
- Chrome 99 on Linux (presumably also on Win/Mac): The Cmd+W and Alt+F4 combos close the tab / window on Chrome, regardless of whether you have data entered into a form field. (I don't think there's a key combination to fully-quit, but Alt-F, X (to open the menu and then select "Exit") does as well.)
I didn't find any browser or any key combo where I get any sort of "are you sure? you have form data entered" prompt.
Note that we do have ways to resurrect lost data, if you happen to accidentally close a tab or window (or quit). Firefox has "Recently Closed Tabs" and "Recently Closed Windows" in the History menu, and if you fully-quit, I believe the history menu also has "Restore previous session" (or you can configure Firefox to do that automatically).
I think that form-field-restoration behavior is newer than most of the comments on this bug, which is why it wasn't mentioned previously here. I can see the strong desire for a "Are you sure?" prompt in a world without session-restore, but it's not as necessary and potentially more clunky-cumbersome than it's worth now that we can ~painlessly restore inadvertently-lost tabs.
So I suspect this may end up being WONTFIX or WORKSFORME-via-sessionrestore-making-it-unnecessary, but I'll reclassify to a more-appropriate component (Firefox|Session Restore) to let the folks over there make that call. (The Layout|Form Controls
bugzilla-component is about the rendering of form controls, but not really about how Firefox handles or reacts to the data that's inside them.)
Comment 101•3 years ago
|
||
Note that individual sites can implement this behavior themselves if they really want a modal prompt to prevent accidental closing of the tab, using this API:
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
This is what happens if you e.g. try to close a Google Calendar tab when you're partway through creating a new calendar-event. And this is appropriate for cases where the site is a dynamic web-app rather than just plain web-form with a list of input fields.
But in general, I think it'd be a step backwards in terms of user experience if we automatically added an "Are you sure" prompt to any form with data entered, as this bug seems to be requesting. As an example, the prompt would probably fire for most search-results pages, since those have a text field at the top with whatever search term the user entered. I doubt we want to add a click-through prompt to all search results pages, since users do a lot of searching and then want to be able to easily close the results and move on with their life.
Comment 102•3 years ago
|
||
Put more concisely: I think the feature-request here makes sense in a world before Session Restore, and undo-close-tab/undo-close-window.
Given that we (and other browsers) have those features (ever since Firefox 4, I think?), this makes less-sense, and is really a different more-in-the-user's-face approach to solving the same problem that Session Restore / undo-close-tab/window already basically solves.
Comment 103•3 years ago
|
||
I think it is <textarea>
data loss that is most problematic.
Daniel, you mention "form-field-restoration behavior is newer than most of the comments on this bug", can you say when it was implemented?
As I'm not seeing it in 91.5.0esr
(which is latest available version in Debian Stable GNU/Linux).
When I type some text for example at https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea and close the tab with ctrl-w
, upon right-click and selecting Reopen closed tab
tab is restored, but all data that I typed is lost. Same if browser closed with ctrl-q
.
(Which is especially annoying as ctrl-w
is common shortcut for delete-word
in most editors/shells I use, and I'm quite likely to do it often)
Comment 104•3 years ago
|
||
(In reply to Matija Nalis from comment #103)
I think it is
<textarea>
data loss that is most problematic.
Undo-close-tab works (generally) to restore the contents of textarea
.
Daniel, you mention "form-field-restoration behavior is newer than most of the comments on this bug", can you say when it was implemented?
It was implemented a decade or more ago; I don't recall precisely when. It's been around for a long time.
When I type some text for example at https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea
Yeah, I can reproduce dataloss-on-restore-tab at that page. That's because that is not a regular page; it's a sandbox with ephemeral dynamically-generated rendering, inside of a dynamically-constructed subdocument.
The content on the right (including the textarea) is dynamically generated based on the markup that you can see (and can edit) on the left, and the page itself discards & rebuilds it on various signals, e.g. if you click the "Run" button. The page can detect that a tab-restore (or a back/forward navigation) has happened, and I wouldn't be surprised if it is regenerating the content on the right (which includes discarding the textarea & its contents) based off of that signal, just as it generates it on the initial pageload.
This is kind-of similar to the Google Calendar example that I mentioned above; sufficiently-complex pages like that can use the "onbeforeunload" event to pop up their own dialog, if they need to.
You can try https://paste.mozilla.org/ as a simpler testcase for textarea
, if you like, where undo-close-tab works fine.
Comment 105•3 years ago
|
||
If there are specific sites where undo-close-tab's form-field restoration doesn't work and it causes trouble, please do file bugs on those! Depending on the situation, breakage could be caused by the site doing something silly or by an actual bug in the form-field-saving browser feature, or a combination of the two. If we're aware of specific issues, perhaps someone can get to the bottom of what's going wrong, and even if it's a site bug, we may be able to suggest workarounds (e.g. telling the site to not inadvertently run JS that clears their form fields when the tab is restored).
(But probably don't file a bug on the w3schools example, since that particular case is almost certainly a situation where the site is intentionally regenerating or stomping-on the content, because the point of the site is to dynamically (re)generate content on-the-fly.)
Comment 106•3 years ago
|
||
(I'll try to report when I stumble upon them, but it seems like fighting an uphill battle... (especially given the effort needed to reach someone with clue at most websites - I usually fight for months just to get their sites which only support SSL 3.0 to get them to work at all; I shudder at amount of work needed to get them to implement some website changes. But I digress). Unfortunately they are likely to be private / behind login / internal networks.)
Perhaps firefox Reopen closed tab
should be behaving more like real undo
functionality - i.e. returning the tab to exact state it was before it was closed using state from memory/disk - before that feature should be considered as good workaround for preventing accidentals closes (e.g. it should work on any web site, including w3schools example, without even doing any network request to undo the close).
Or, perhaps the default behaviour for onbeforeunload
(if not explicitly specified by website) should be among the lines of "if modifed textarea
, then show alert before closing". Then websites could still modify it if they want (including setting it to no-op), but sites which have not been updated in ages would offer protection.
(Or disable ctrl-w
shortcut if website has textarea
and did not specify onbeforeunload
, but that feels kludgy...)
Comment 107•3 years ago
|
||
Oh, and additional hint if someone for whom form-restoration does not work on any website stumbles on this - you (or some privacy addon) might have set firefox browser.sessionstore.privacy_level > 0
in about:config
.
Comment 108•3 years ago
|
||
As someone who created the duplicate bug 277580 some 5 years ago - I can confirm that form-field restoration almost, but not completely, solves this problem.
In most situations where this happened to me recently, my form input was preserved using Reopen Closed Tab. So, good job there.
The most obvious situation where this doesn't work is when there is only one tab. In this case, Ctrl+W completely closes the browser, and bye bye all page state and form input.
Comment 109•3 years ago
|
||
The most obvious situation where this doesn't work is when there is only one tab. In this case, Ctrl+W completely closes the browser, and bye bye all page state and form input.
Luckily, for that one, there is advanced preference browser.tabs.closeWindowWithLastTab
that one can use to workaround that specific issue.
Comment 110•3 years ago
|
||
(In reply to denis bider from comment #108)
The most obvious situation where this doesn't work is when there is only one tab. In this case, Ctrl+W completely closes the browser, and bye bye all page state and form input.
This actually does work in that situation, too. (You don't need a pref-flip as suggested in comment 109, though that does seem to be an additional help.)
- If you have another Firefox window open (i.e. you haven't fully quit), you can reopen the closed window by using the "History | Recently Closed Windows" menu.
- Otherwise: if this was the last Firefox window (i.e. you've quit by accident by closing the last window), then you can just launch Firefox and use "History | Restore Previous Session"
Many of the comments here focus on Ctrl+W (since that happens to be easy to trigger by accident particularly if you're an emacs user), but close-tab and quit aren't actually that special in terms of being destructive. Back, Forward, Reload (via e.g. accidental Ctrl+R), and clicking-a-link could all be just-as-destructive. So to really solve this with a prompt, the browser would need to prompt on all of those actions (when the user has entered some text).
Fortunately, form-field restoration elegantly provides a way to restore your lost data in all of these cases, without interrupting the user by forcing them to click through a dialog. (The same mechanism gets used to save form-data on reload or back+forward as gets used for undo-closed-tab.)
Comment 111•3 years ago
|
||
That's useful to know, thank you.
I was not aware of History | Restore previous session. Perhaps it could be useful if I explain how much trouble I had finding it, AFTER I read your comment.
-
I conveniently just had a Firefox window open where there was only one tab. I closed that tab to completely exit Firefox.
-
I reopened Firefox. It launches with an empty tab, the way I have it configured.
-
My first instinct was to right-click the title of the empty tab and look for "Restore previous session". Not found there.
-
My next instinct is to right-click the page content of the empty tab and look for "Restore previous session". Not found there.
-
I remembered your message said it was under "History". So I open the History dock with Ctrl+H. I click and right-click all components of that interface, looking for "Restore previous session". Not found.
-
Maybe it's in the menu. I look for "Restore previous session" in the main Firefox menu. Not found there.
-
After clicking around the whole interface for a while, I finally capitulate and go back to your message.
-
I read your message again carefully, and I see it says "History | Restore previous session". So I open again the Firefox menu, I find the History entry, and I see that's actually a sub-menu! Gee-whiz! Ah, there it is.
All of this may sound stupid, but I think it's worth pointing out that the feature is not in the first 3 intuitive places where I looked, and that I did not even think to look in the place where it actually is.
Comment 112•2 years ago
|
||
In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.
Description
•