What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

Possible Duplicate:
Prevent closing window while writing comment

I've noticed that no confirmation dialog is displayed when the user clicks away from a comment that they are writing. If a user clicks away from a half-written comment, the comment can disappear completely, and be lost entirely. To prevent this from happening, a dialog should be displayed when the user tries to navigate away from the page, warning them that they will lose their edits if they continue - I have lost the content of my posts on a few occasions, which can be frustrating.

share|improve this question

marked as duplicate by Arjan, hims056, Bo Persson, Martijn Pieters, Jim Dec 28 '12 at 16:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I imagine that this issue would be fairly easy to correct - it would only require a client-side script to detect partially written questions or comments. –  Anderson Green Dec 28 '12 at 4:16
Whenever I start to write a comment (and then click a link on the same page), the comment disappears without warning. If a warning dialog were displayed on-click, this problem would be resolved entirely. –  Anderson Green Dec 28 '12 at 4:17
If we talk about post (question or answer) there is a feature called draft. So if you close the window where you are writing an answer, it will be store in draft. –  hims056 Dec 28 '12 at 4:22
@hims056 For some reason, this doesn't happen whenever I start to write a comment on a page. Comment drafts are not saved, and a dialog is not displayed if a user clicks away from the page when writing a comment. –  Anderson Green Dec 28 '12 at 4:25
Drafts are automatically saved after every 45 seconds So if you leave the page after 45 seconds, the draft will be there. –  hims056 Dec 28 '12 at 4:29
@hims056 Drafts still do not exist for comments, and no confirmation dialog is displayed to prevent loss of content. –  Anderson Green Dec 28 '12 at 4:31
Ohh so you have removed posts from your question. –  hims056 Dec 28 '12 at 4:53
@hims056 I was mistaken about content being lost for questions and answers. It appears that this issue only affects comments. –  Anderson Green Dec 28 '12 at 4:56
add comment

1 Answer

Comments are treated as ephemeral, second class citizens when it comes to content on Stack Exchange sites. Just getting them implemented was a bit of an uphill battle that was conceded to get people to stop writing answers as comments, despite clear instruction otherwise.

Later, they got a bit of love via voting, because conversations in comments tend to be rather noisy. We needed a way to make the useful bits (that should probably be moved into the post later) stand out.

If you want to save drafts, or alert when navigating away before saving a comment, that's something you can easily do with a user script. In fact, local storage is an ideal place to store boilerplate comments and drafts.

I personally don't see why it's necessary to alert on unload if a comment has not been saved, unless it's just for the sake of consistency. There would be instances where it would actually get in my way more than help, as I quite often tend to change my mind about leaving a comment and just close the tab instead (while moderating, one tends to have many open tabs).

I also don't see a reason to introduce a change that gives comments any more importance than they have. In fact, I'd like to see them be seen as even less important, as they are a frequent source of noise for us.

share|improve this answer
Sometimes, I like to respond to the content of a post (or ask for clarification.) without actually editing the post. ^-- I just did that here. ;) And there's still no PM system for users (so one user can specifically address another user publicly), aside from comments - if comments didn't exist, then how would users be able to talk to each other at all? –  Anderson Green Dec 28 '12 at 6:05
Also, it would be great if comment "drafts" were stored in local storage by default, without needing to be stored on the server. If this were implemented by default, userscripts wouldn't be needed as a workaround. –  Anderson Green Dec 28 '12 at 6:09
@Anderson, if you're saying you also want the current post drafts to go into local storage: I like my post drafts to be stored on the server as that makes it much easier to continue in another browser/location, and survives the many times I reset my browser. (And even works in the event of true disaster, where the computer itself breaks—but that is rare of course, and one would probably care less about a post when that happens.) –  Arjan Dec 28 '12 at 10:39
Some comments are useful, and they're the ones that tend to include multiple links and are most at risk of being lost. If I can do it easily in a user script (link?), why not include that code in Stack Exchange's JS? –  Gilles Jun 20 at 12:00
And yet again, spend a couple of minutes collecting the right FAQ links to help a user whose question I'm closing… and lose it all due to a misclick. *&()@$)(#*^&#()$ Please fix this. –  Gilles Jul 4 at 10:05
add comment

Not the answer you're looking for? Browse other questions tagged .