When writing an answer and do anything that would result in another page to be loaded in the same window we get a dialog box Leave Site? Changes you made may not be saved.
So we don't accidentally lose what we have written.
But while writing a comment and click on an image that is within the question, this image is opened in the same window without any warning and the whole comment is lost.
That happened to me three times in a row until I realized why that happened: the question had an image with a large white area at the bottom at which I clicked to bring the window back to the foreground.