I didn't report this earlier as it is such a subtle bug and difficult to reproduce. I first noticed this many months ago, likely right after the comment update that split the "add comment / show all comments" button in two.

I often browse "hot network questions". I don't have an account on all SE sites. If I leave a tab open for a while and somebody adds a comment to an answer or the question, the "show more comments" link on that particular answer does not expand the comments (instead it acts sort of as a link to #top). A page reload fixes this however, and this only occurs for unregistered users.

I don't have any kind of visualization of this because I can't reproduce it on demand for obvious reasons. (This bug always reproduces when somebody adds a comment, but getting somebody to add a comment on demand is more challenging.)

This report is a duplicate of this question. My attempt to clarify the title to better reflect the content was rejected (I understand why, as the question hard to comprehend with all the edits, and I refrained from changing the content too much), and I figured posting a new question is the best way to clarify the issue, and bring to attention the fact that this regression is bordering on annoying yet remains unfixed many months after introduction.

I use Opera, but it's likely not browser specific as others have reported the same issue on Firefox and Chrome in the other question.

1 Answer 1


This is caused by the fact that the code that updates the comment links when new comments arrive will, incorrectly, mark both the "add a comment" link and the "show n more comments" link as disabled for anon users.

Specifically, looking at the code, the bug appears to be within the setCommentsMenu() function, which is called from StackExchange.comments.realtimeMessage() to update the comment count whenever a notification about new comments arrives. It's kind of hard to pinpoint where exactly the bug is in the function, since it seems to contain several parts that need fixing, but I can at least observe the following issues:

  • When the comment count is updated live, the "add a comment" link will be shown even if the user is not allowed to comment. This doesn't match the behavior of the server-side code, which will only show the "add a comment" link to anons if there is no "show n more comments" link. (This is sort of tangential to this bug, but I thought I'd mention it.)

  • If commenting is disabled (specifically, if the addlink-disabled data attribute is set for the post), the setCommentsMenu() function adds the disabled-link attribute to both the "add a comment" link and the "show n more comments" link. In fact, it does it twice: first it disables all comment links with:

    if (this.jtBody.data('addlink-disabled')) {

    and then later it, redundantly, disables both links specifically with:

    if (this.jtBody.data('addlink-disabled')) {
  • The StackExchange.comments.realtimeMessage() function contains the line:


    which looks like an attempt to re-enable some link or links after they've been disabled by setCommentsMenu(). However, as far as I can tell, this line actually does nothing useful, since the commentLink variable actually points to the <div> containing the links, rather than to the link(s) themselves.

A workaround for this bug is now included in the Stack Overflow Unofficial Patch user script, as of v1.24. What it does, in effect, is monkey-patch the setCommentsMenu() method to add the following code at the end:

if ( commentsCount > 0 && this.jtBody.data('addlink-disabled') ) {
    this.jCommentsLink.find('.js-add-link, .js-link-separator').addClass('dno');

Removing the disabled-link class from the "show n more comments" link is enough to make it functional; the next line just hides the "add a comment" link next to it, to make the UI more consistent.

Update: It looks like this has been quietly fixed at some point. Specifically, the first two snippets quoted above have been replaced with just:

if (this.jtBody.data('addlink-disabled')) {

You must log in to answer this question.

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