Minor bug report in hiding "0 votes" from topic list

Continuing the discussion from Voting plugin — hiding "empty" votes in the topic list?:

If you have “simple” tag display enabled, and the post has at least one tag but no votes, the tag list will be followed by a comma.

Because:

.discourse-tags .discourse-tag.simple:not(:last-child)::after, .list-tags .discourse-tag.simple:not(:last-child)::after, .search-category .discourse-tag.simple:not(:last-child)::after {
	content: ", ";
	margin-left: 1px;
}

and the vote count is still a child even when hidden, I guess.

1 Like

The easiest workaround is to not use “simple”, of course.

1 Like

4 posts were split to a new topic: How to hide 0 votes?

Right, when hidden with CSS it’s still counted as a child because it still exists in the HTML.

CSS can mostly handle this now (with Firefox being the exception because it doesn’t yet support :has)… It’s probably worth adding a proper “hide 0 votes on topic list” option to the plugin to avoid the issue entirely… but for now this will work.

.vote-count-0 {
  display: none; // hide 0 vote count
}

.discourse-tags:has(.vote-count-0) { 
  .discourse-tag:nth-last-child(2):after {
     display: none; // hide the comma on the second to last tag
  }
}
1 Like