-22

What is the point of showing the "sorted by" options when there is only 1 answer?

enter image description here

18
  • 14
    Probably so they didn't have to add extra logic to determine whether to render the dropdown.
    – vandench
    Commented Mar 23, 2022 at 22:45
  • @vandench so why don't we see in this question the dropdown without any answer?
    – serge
    Commented Mar 23, 2022 at 22:48
  • 10
    Probably because the answer sorting dropdown is a sub-element of the entire answer section element.
    – vandench
    Commented Mar 23, 2022 at 22:49
  • @vandench that asks a simple boolean comparision > 1 to the client side
    – serge
    Commented Mar 23, 2022 at 22:51
  • 4
    @serge Yes. That is extra logic. Regardless of how simple it is, it is still more logic. And it requires time to develop, test, and maintain when there are bigger priorities. That said, until you get a status- something tag, who knows what will happen
    – cocomac
    Commented Mar 23, 2022 at 22:53
  • "More code to check for something is by definition extra logic", surely, any computer application is extra logic then
    – serge
    Commented Mar 23, 2022 at 22:54
  • @cocomac so for you the best application is without any logic: there is nothing to test, nor develop and there are a lot of time for the bigger priorities
    – serge
    Commented Mar 23, 2022 at 22:58
  • 1
    "surely, any computer application is extra logic then", I suppose that's a reasonable straw assumption. Frankly triaging is a thing, some features are important, others aren't. Those others require teams to consider those edge cases, require developers to write code to handle those edge cases, requires QA to add a substantial amount of tests to ensure that edge case doesn't conflict with all of the other edge cases, you can see where this is going. Feature's take time and money, and companies only have so much of it.
    – vandench
    Commented Mar 23, 2022 at 22:59
  • @vandench but for a such great application that is SO, how stupid is display to sort one element. one test and one comparation in javascript.
    – serge
    Commented Mar 23, 2022 at 23:01
  • 4
    @serge No, I didn't say less logic is better. Yes, the more logic there is the harder it is to maintain. I'm hesitant because more logic creates more complex code, which can lead to technical debt. And that lead to the third most downvoted Meta SE post of all time. So no, I'm not against this change. But I worry that having lots of tiny things to make is as perfect as possible carries significant risk of technical debt, which is harmful.
    – cocomac
    Commented Mar 23, 2022 at 23:04
  • 2
    I think you're forgetting the most important question when triaging bugs: Is this harming anyone? If not, then there are almost certainly more important things to work on.
    – vandench
    Commented Mar 23, 2022 at 23:04
  • 17
    Another point is the logic may not be as simple as mentioned above. Not everyone has access to the same information when viewing a Q&A. For example, if there is 1 undeleted answer and 1 deleted answer. Should the sort menu be rendered? Only rendered for people with the ability to see deleted answers? Now we're checking which answers are visible and if the user can see them or not etc.
    – Henry Ecker Mod
    Commented Mar 23, 2022 at 23:06
  • @vandench the application style, colors, fonts, background, does not harm anyone, and however they are respected in all applications, and there is a lot of work on the application style. Not anything that does not harm does not worth doying.
    – serge
    Commented Mar 23, 2022 at 23:07
  • 4
    @Tom not true, those who report it usually get a beating with something heavy im the shape of an S...
    – 0Valt
    Commented Mar 23, 2022 at 23:45
  • 1
    @OlegValteriswithUkraine Who said this can't happen here as well? ... :D
    – Tom
    Commented Mar 23, 2022 at 23:48

2 Answers 2

24

The sorting options are shown persistently, even when there is only one answer, for a couple of reasons.

First, it simplifies the logic required in the code, eliminating the need to check for and handle a bunch of different conditions. Not only does this make the code easier to write and reason about, but, more importantly, it makes it easier to test, because there are fewer different permutations that need to be tested. Less code with simpler logic is, in general, preferred, in absence of compelling evidence or reasons otherwise, as code that doesn't exist cannot have bugs in it.

Second, it maintains a consistent, common user interface. This not only helps with usability (e.g., muscle memory), but it also helps with user education: teaching users about how the site works as they go about using it.

Third, your chosen sort order is persistent, meaning that it sticks across questions. In other words, it doesn't apply just to the page you're looking at; it is saved as a preference for your account. Even if there's only one answer on the question you happen to be looking at, you should still have the ability to change your sort-order preference.

Fourth, and perhaps a bit flippantly, set theory says that a set of one is still a set. :-)

I am not a developer on the Stack Overflow platform, but there may well be a fifth reason: pages on this site support "live update/refresh", such that if an additional answer was posted while you were on the page, then it would immediately appear. If the sort options were not always present, then this "live update/refresh" logic would have to be further expanded to check whether the sort widget was already visible and, if not, show it. Besides the fact that that introduces an extra step which may have performance implications, adding new elements to the DOM after the page has been loaded/rendered can be disorienting, causing things to jump around on the screen for the user.

Having the sort options visible when there is only one answer doesn't cause any problems (it can't, for example, cause the answer to disappear, or cause unrelated answers to appear), so why shouldn't it be there?

8
  • 1
    when present the combo has any functionality and does not add any userful thing to the user experience besides question like that: why the SO so experienced team left that combo for one single answer?
    – serge
    Commented Mar 23, 2022 at 23:21
  • 1
    any graphical element should have a practical meaning, if not it does not respond to an esthetically organised interface, if you have a lot of buttons that does nothing at all
    – serge
    Commented Mar 23, 2022 at 23:25
  • 8
    The widget not having any useful functionality is not a reason to remove it; you need something more compelling as a justification than that. I can think of dozens of UI elements on the page right now that have no useful function, but they're still there. Heck, the "Add comment" button just to the right is there, even when I cannot click it, because there is no text in the comment box to submit.
    – Cody Gray Mod
    Commented Mar 23, 2022 at 23:26
  • that may simplify the code for some few lines, but looks still bad
    – nbk
    Commented Mar 23, 2022 at 23:56
  • 8
    I was reminded by Oleg that the widget does actually have useful functionality, even when there is only 1 answer on the page: it allows you to change your sort-order preference. I've updated the answer to reflect this information. Maybe 4-5 reasons is enough? Let me know if I need to keep brainstorming.
    – Cody Gray Mod
    Commented Mar 24, 2022 at 0:09
  • 5
    UI's where controls disappear are just horrible anyway. It's better to make them inactive when irrelevant. But indeed, then the "possible fifth" reason still applies. I'd like to expand on that one too: a page with only one visible result is not necessarily a page with only one result. It also depends on your filters what you can see and what you cannot.
    – Gimby
    Commented Mar 24, 2022 at 13:06
  • I do not find these arguments convincing. (1) The same logic is in place for the text "Answer" vs "Answers" so it's already there; (2) and (3) The box is not there when there are no answers, so "having the setting available at all times" is anyway not achieved; (4) An empty set is also still a set; (5) (related to (1)) Does the text change from "Answer" to "Answers" when a second answer is added while looking at the page? If so, this box could simply react to this text label. Commented Jun 23, 2022 at 14:56
  • So, on the contrary, I think there are good reasons to keep the interface relevant and tidy. But I understand that this is the minority view here -- I just want to highlight that the arguments on which the majority view is based are so easily refuted that it really boils down to just being an opinion either way. Commented Jun 23, 2022 at 14:56
2

I have created a userscript that removes the sorting when only one answer is visible. Find it on StackApps.

I personally do not like an UI element to conditionally be shown. However, if others prefer it that way, this is very easy to address as an option, hence why I created the userscript.

You must log in to answer this question.

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