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

I know that normally tags are sorted by popularity; tags with more questions get listed first. However, sometimes when you go to retag a question (inline), it randomly sorts the tags. I can't figure out how exactly they're being sorted, it truly seems to be random.

For example, take this set of tags:

Ordered set of tags

When I clicked the "edit tags" link, I got this:

Unordered set of tags

In this specific case, they're backwards. That isn't always the case though.

I've notice that this only occurs on older posts. Perhaps at some point SO started storing tags for each post in the order they should appear. Now later on, when you attempt to edit tags on those posts which weren't ordered, they're appearing in the order they were originally entered. Just a random guess.

Any way it's put, it needs to be fixed. It's extremely annoying when you go to edit tags and you accidentally click the x on the wrong tag because you were expecting the one you wanted to remove to be in that spot. Then you can't quite remember what tag was there, so you have to cancel and reload.

Updating all the questions back past when this feature (if it exists) was implemented seems like a bit of a overhaul, especially considering that a large majority of those questions won't ever need tags edited. So, can this be implemented into jQuery somehow to keep the tags in the same order?

Note: I'm only marking this bug under inline tag editing, because editing it normally completely changes the screen, where you would most likely have to scroll or relocate your mouse to get to the tags box. If it happens there, it would be much, much less noticeable.

share|improve this question
Looks alphabetical. Then again, the tags on this question itself aren't alphabetically sorted. – Manishearth May 6 '12 at 3:28
The tags are sorted by the number of questions with the tag in question that contain diagrams with hand-drawn circles and arrows. If there's a tie, the system totals occurrences of the word "unicorn" in the tagged questions. – Neil Fein May 6 '12 at 4:32
Can you point to an example of this that replicates the "problem"? – Werner Mar 25 at 6:48

1 Answer 1

I just noticed this same thing and posted it as a bug report here before I noticed this one existed. I deleted that post, but here is some of what I had written.

A post I just looked had its tags shown under the post like this:

enter image description here

Upon clicking "edit tags", the inline tag editor that replaces the tags displayed like this:

enter image description here

It's only a minor issue but it does mean you have to be extra careful and do a second look when using the otherwise super smooth inline tag editor. I noticed this when attempting to remove the "managment" tag (which my brain remembered as "delete 3rd tag") and accidentally deleting "unmanaged" instead. From a behavioral perspective it means a user must remember a string then find that string in a (small) shuffled list after pressing the button, rather than remembering a position (e.g. 3rd) or physical location. (If you had to do a double-take to spot the difference between the two examples above, then this might affect you more).

However, I also notice that for questions where this happens (for example, this one, at the time of this writing), the tag order displayed in the revision history of the post matches that of the inline editor. It's the post display itself that is the odd one out. So it could be the case that this is a post display issue rather than an issue with the inline editor.

Another thing I noticed is you can spot these in SEDE. For questions that show this problem, their Post.Tags value contains the tags in a different order than the most recent tag-related entry in PostHistory; the former reflects the display order of tags on the post (and seems to be sorted in decreasing order of post count per tag), the latter is what is displayed in the inline editor and the revision history.

Here is a query that will find the questions that have this problem. Five results from SO as an example ("tags in post" is what you will see displayed, "tags in revision" is what you will see in the inline editor):

Id     Tags in post                                       Tags in revision                                                                                            
------ -------------------------------------------------- -------------------------------------------------
746    <string><language-agnostic><format><title-case>    <language-agnostic><string><format><title-case>
769    <math><linear-algebra><system><linear-equation>    <math><system><linear-equation><linear-algebra>
1171   <python><data-structures><performance><graph>      <python><data-structures><graph><performance>
1180   <dns><web-applications><subdomain><user><account>  <web-applications><dns><user><account><subdomain>
1505   <iphone><html><favicon><apple-touch-icon>          <html><iphone><favicon><apple-touch-icon>

The query is limited to 100 to not cause issues with [Post Link], but with the limit removed, there are at least 50000 (result cap) such questions on SO. However, the query also gets some false positives on newer questions (I suspect my treatment of PostHistory is too simplified) so I can't be sure of the actual count.

So, I'd also like to see this fixed, although given animuson's observation that it only seems to happen on older posts and theory that it has something to do with the way tags are stored (which the query above supports), perhaps it is trickier to fix than it looks.

share|improve this answer
Can you point to an example of this that replicates the "problem"? – Werner Mar 25 at 6:46
@Werner stackoverflow.com/questions/567631/… post displays c# asp.net permissions zip impersonation; inline editor swaps permissions and impersonation. However, I just noticed that the revision history displays the same order as the inline editor; it seems that the post display is the odd one out. – Jason C Mar 25 at 6:53
@JasonC The post displays order the tags by current popularity. I think that this is the source of the problems. – yo' Mar 25 at 14:47
@yo' Yeah; the Posts.Tags field in SEDE also reflects current popularity ordering. Perhaps this happens because the popularity ordering of the tags has changed since the question was first posted, and that ordering is actively kept up to date in Posts but not in PostHistory? That could explain why it seems to happen more for older questions, although it is strange that the inline editor chooses the order from the revision history rather than from the post itself. – Jason C Mar 25 at 15:05
@JasonC That's what I'm thinking. Remember I'm not anyhow related to SE, it's only my 6th sense ;) – yo' Mar 25 at 15:33

You must log in to answer this question.

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