Numbers Cut-Off in Long List


(Dungeon Mistress) #1

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.


(Joshua Rosenfeld) #2

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.


(Jeff Atwood) #3

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


(Neil Lalonde) #4

FYI the SCSS used:

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

(Jeff Atwood) #5

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

(Sam Saffron) #6

CSS is broken on mobile numbers are cut


(Jeff Atwood) #7

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

(Eli the Bearded) #8

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.


(cpradio) #9

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.


(Sam Saffron) #10

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”


(cpradio) #11

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


(cpradio) #12

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:


(cpradio) #13

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!


(cpradio) #14

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


(cpradio) #15

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


(Sam Saffron) #16

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.


(cpradio) #17

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)


(Jeff Atwood) #18

Sure go with that for now.


(cpradio) #19

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:


(cpradio) #20

Okay, had to approach it differently as doing the same fix for ol actually broke the main navigation.

Before:

After: