Unread indicator/counter on a new line

Hardly world shattering, but the OCD part of me can’t handle things like this :wink:

and

image

4 Likes

https://github.com/discourse/discourse/pull/5772

2 Likes

What do you think @awesomerobot?

Can you explain what the ~ in Handlebars does within the commit message?

I agree @bartv! this is a slight annoyance for me too.

@notriddle, I just tried this out and it’s not working for me.

.topic-post-badges {
  white-space: nowrap;
}

This is preventing wrapping within .topic-post-badges, whitespace between the badges and the title will still wrap.

As long as these two elements are siblings I don’t think we can avoid widowing the badges.

The only way I can think of to get this to work would be placing .topic-post-badges div inside the a.title.raw-link.raw-topic-link, and then use an   to put a space between the badges and the link text…

3 Likes

~ strips out whitespace (in this case the preceding whitespace), more examples: http://handlebarsjs.com/expressions.html#whitespace-control

2 Likes

I added a mention of what the ~ syntax does.

That’s why I tried to strip all the whitespace between the badges and the link text itself. I’m guessing that something’s getting rendered between them, and it contains whitespace on the particular topic that you’re looking at.

Strange that it works for you… I even tried to remove any additional whitespace manually from the inspector just to test it

I can just merge it and see what happens, worst case scenario is nothing changes.

2 Likes

Changes are live here and I’m still seeing widowing… are you seeing the same @notriddle? I can’t imagine this would be a browser/OS difference… so I’m back to thinking:

2 Likes

It has to be dependent on the browser version (I’m a Firefox, you’re a Chrome).

Maybe we should change https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/topic-post-badges.raw.hbs to start with a  ? I notice that the space that’s supposed to be between the badge and the topic title is present in my browser, but absent in yours, meaning there’s probably some whitespace collapsing difference that’s influencing where the line break is (or, in my case, would be) happening.

1 Like

Okay, I tried it in another browser (MS Edge, actually) and it’s behaving like your browser is. I managed to fix it so that it works right in both Edge and Firefox. But before opening another PR, let’s try iterating in Theme Creator:

https://theme-creator.discourse.org/theme/notriddle/no-widowing

Does that work in your browser, @awesomerobot?

3 Likes

:tada: that did it! thanks for figuring it out, this fix is much simpler than what the alternative would have been. If you make a PR I can merge it in.

3 Likes

https://github.com/discourse/discourse/pull/5775

7 Likes

There was one minor problem still there

https://github.com/discourse/discourse/pull/5777

6 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.