Clicking 'discard' under an answer whilst editing a post inline causes the tags in the edit to also be removed

by ᔕᖺᘎᕊ   Last Updated August 15, 2015 17:10 PM

A gif to explain:

enter image description here

As you can see, clicking 'discard' under an answer whilst editing a post inline causes the tags in the edit to also be removed.

I presume this is because the click handler for the 'discard' button is the same for questions and answers; if it is a question, it does need to delete the tags. But this doesn't work for answers - please can a new handler be made/or the existing one edited to check whether the discard is for a question or answer, and decide whether the tags need to be discarded or not.


I understand this is a rare case - but it looks easy to fix... if it is, please can it be fixed? :)

Tags : bug edits draft


Answers 2


Upon inspection of wmd.js, it seems the bug-causing part is:

var tags = $('#tagnames');
if (tags.length > 0 && tags[0].func_clear) {
    tags[0].func_clear();
    tags.blur();
}

Now, I don't know what func_clear() means... but it looks like it's clearing the tags...

To fix, a simple way would be to check whether we are on an answer page or question page, and the easy way (I think) to do that would be to check whether body has the question-page class:

if(!$('body').hasClass('question-page')) {
    var tags = $('#tagnames');
    if (tags.length > 0 && tags[0].func_clear) {
        tags[0].func_clear();
        tags.blur();
    }
}

So it won't happen on question pages.


This is just a small inspection - there is probably a better way, and my suggestion might actually break something unintentionally...

ᔕᖺᘎᕊ
ᔕᖺᘎᕊ
August 15, 2015 10:06 AM

A fix for this is rolling out in the next build (build rev 2015.11.17.3887 on MSE/MSO, 2015.11.17.2998 on sites).

m0sa
m0sa
November 17, 2015 13:08 PM

Related Questions


Draft saving is unreliable

Updated February 27, 2018 17:24 PM

To whom is a saved draft visible?

Updated March 02, 2017 13:24 PM


Retrieving drafts, if they exist in reality?

Updated March 25, 2018 15:24 PM