Analogous to how an editor asks before closing an unsaved non-empty document, Firefox should ask before leaving a page with an unsubmitted non-empty form. (By going to a different URL or closing the tab/window.) (By “non-empty” I mean the user did actually input something.)
A way for pages to control if the user should be asked before leaving already exists, and this could use that existing mechanism. (By defaulting it to “ask” if the user input something into a form.)
This elegantly, simply and naturally solves a long-standing problem in a much better way than automagically keeping the form state somewhere and praying it hasn’t vanished from that buffer before you re-open the page.
The most common situation for this is probably on mobile, where one mis-tap on way too tiny imaginary buttons and links suddenly closes the imaginary keyboard or clicks on a link unintendedly (maybe by a “side finger”) or some other crazy thing. And on the PC, by pressing any of the various non-discoverable, barely documented and not configurable keyboard shortcuts that result in such an action. (E.g. Ctrl-Q / Ctrl-W / Ctrl-Shift-W / Tab, Enter [if there is a link there] / Tab, Backspace [always] / Ctrl-[ / even Ctrl-R … Ctrl is often used together with keyboard navigation, for switching between tabs etc or for faster movement in text. Also, on pages with unexpected keyboard shortcuts, like YouTube and GitHub.) I’m literally writing this because it happened too many times in the last 30 minutes. And it has always been a severe annoyance each time. Without Form History Control it would drive me completely off even using input fields in browsers.
... View more