7

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? :)

  • Curious: What are those checkboxes? – Spikatrix Aug 15 '15 at 10:44
  • @CoolGuy they are checkboxes to add pre-defined edit reasons for easier editing - you'll find a few scripts to do this on Stack Apps. If you want this feature yourself, you could use my SE Additional Optional Features userscript ;) You'll get a bunch of other features as well! :) – ᔕᖺᘎᕊ Aug 15 '15 at 11:07
  • 1
    +1. As you stated, it is rare, but if the option is available/provided it should work properly :) Besides, rare or not, this is arguably a substantial bug, as clicking "discard" on an answer should not remove all tags on a question. Even if for Stack's sake they should look at where their scripts are being a bit rogue. – James Aug 15 '15 at 12:48
  • 1
    also happens on the /questions/ask page when providing an answer to your own question, but there it actually removes everything (question + answer) – m0sa Nov 13 '15 at 13:58
  • @m0sa are there any plans to fix it? ;) or has the cause been found? – ᔕᖺᘎᕊ Nov 13 '15 at 16:25
2

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).

0

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...

You must log in to answer this question.

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