Numbers Cut-Off in Long List

I searched for quite a while and didn’t see anything about this.

We have several lists of episodes that go into 2- and 3-digits, and the left side of the numbers are cut off starting at about 20.

When you get to triple-digits, the entire first number is gone.

Is this something I can have an Admin adjust on our end?

Example of double digits

Example of triple digits

Thank you for any help you can give me.

4 Likes

This is a Discourse issue, nothing to do with your site.

See https://try.discourse.org/t/testing-long-lists/708?u=jomaxro

Moving this to #bug, unless the team feels it’s better in #ux.

3 Likes

Just edit the relevant CSS as needed in Admin, Customize, CSS

1 Like

FYI the SCSS used:

.topic-body .contents {
    ul, ol, dd {
        margin-left: 40px;
    }
}
4 Likes

Let’s see, now that commonmark is here we can start with whatever number we like and it is easier to demo this

  1. six-hundred-sixty-six

and

  1. sixty-six
1 Like

CSS is broken on mobile numbers are cut

I don’t know that we really need to allocate enough space for ten digit numbered lists… I think allowing space for the digit one plus two more, should work, eg:

  1. the number “122” should work

vs.

  1. the number “9999” doesn’t need to

Except that one of the cases I’ve run into this is starting a line with a four digit year.

July 20th in History.

  1. The first Women’s Rights Convention in Seneca Falls, New York ends.

  2. British Columbia joins Canada.

  3. The first International Special Olympics Summer Games are held at Soldier Field in Chicago.

  4. Apollo 11 lands, first humans on the Moon.

In the preview, your quoted “9999.” is shown in full, but my years cut off the first digit. In your post, I just see two digits of your “9999.”. Of course, since this thinks I’ve created an <ol>, all of the years after the first are trashed anyway.

1 Like

It seems to be due to this rule

ul, ol, dd {
    margin: 0 0 9px 25px;
    padding: 0;
}

If you comment that out, or “mark as it inactive in dev tools”, the list numbering just works, with any numbering.

It seems the padding: 0 is the bigger culprit of that rule for causing issues.

3 Likes

Can you do a few screenshots of before and after?

We might as just do a PR to clean up this CSS if there is no impact on the “before”

I’ll see what I can come up with. Might not be to later tonight though.

2 Likes

Before:

User Menu:

Homepage:

Preview creating Topic:

Cooked Topic with Unordered Lists, Ordered Lists and Definitions


After

User Menu:

Homepage:

Preview/Editing Topic that was created:

Cooked Topic with Unordered Lists, Ordered Lists and Definitions


Just for Kicks and Giggles:

(no before captured)

Preview Pane:

Cooked Version

Verdict:
The browser seems to use “safe” defaults for padding/margins to prevent ridiculous rendering? (tested in latest Chrome and IE 11 – because I had access to it)

I’ve yet to pin point why the preview shows 5 digits and cooked shows 4 when both have a padding of 40…


PR:
https://github.com/discourse/discourse/pull/4980

5 Likes

For those wondering, I took screenshots of the menus and homepage because they utilize ol for the category/tags drop down and wanted to show they were not impacted negatively by this change.

The User Menu probably doesn’t use it, but figured, might as well screenshot it too!

3 Likes

Here is a CodePen showing browsers cut off crazy long list numbers too (so it isn’t Discourse specific)

https://codepen.io/cpradio/pen/xrvLpg

1 Like

I know why this occurs now, the 5 is in the “overflow” boundary and the preview content is within another div that has a padding of 7px all around, thus the overflow of the 5 is able to be seen.

Preview padding, showing the 5 in overflow.

Cooked indicating no additional padding, thus no overflow shown

5 Likes

OK, this now merged:

The indent for lists now is quite deep:

And not really consistent with indenting of bulleted lists, which does impact readability.

  1. testing
  • testing
  1. testing

@awesomerobot can you have a quick to see if there is a CSS fix to improve this a bit?

If not, one options may be to place a class via the renderer on “big” lists.

Then we can use our old styling and add some additional rules for

.ul.digits-2
.ul.digits-3

and so on.

3 Likes

The simple solution is to remove ul from the rule I removed ol from, that would make them both indented the same browser default amount.

I can submit such a PR fairly quickly (if you’d want to go that route)

4 Likes

Sure go with that for now.

K, I’ll get that done tonight. Let me go most of the endpoints of Discourse to make sure it doesn’t do anything crazy to the existing UI and I’ll get it submitted. :slight_smile:

Okay, had to approach it differently as doing the same fix for ol actually broke the main navigation.
https://github.com/discourse/discourse/pull/4999

Before:

After:

6 Likes