Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

List bug

My apologies if someone has already reported this bug.

I like to double-space my list items, instead of having them all run together.  However, when I go into the list item and insert a <p> tag in front of the list items, City Desk (version 2.0.19) gets confused and inserts another, empty, list item in front.

This happens for both ordered and unordered lists.  It is most obvious in ordered lists, because they start numbering from "2" instead of "1".  Unordered lists show up extra blank spaces as an indicator of the problem.

Also, the display in the "Normal view" gets messed up for a little bit, and I have to flip back and forth between "Normal view" and "HTML view" a few times to correct it.

Repro steps:
----------------
1)  Create a new article, or go into an existing article.

2)  In "Normal view", click on the ordered list button, and enter three text items (to generate three separate numbered list items).  Like so:

    1.  first item
    2.  second item
    3.  third item

3)  Switch to "HTML" view, and change the HTML code from:

<li>first item</li>
<li>second item</li>
<li>third item</li>

to:

<p><li>first item</li></p>
<p><li>second item</li></p>
<p><li>third item</li></p>

(it doesn't matter whether you add the </p> at the end or not, either way will cause this problem)

4)  Switch back to "Normal View" and examine the list.  Sometimes things work as expected, and sometimes they don't.  If the list appears okay, then switch back to "HTML View", and then back again to "Normal View".  (In my case, I only ever need to switch out and back once, and most times I don't even need to switch out the first time to see this problem.)

This invariably (at least for me) causes the list to look like:

    2)  first item



    3)  second item



    4)  third item


With tons of undesired white space in-between each list item.

The list HTML code now looks like:

<ol>
<li style="LIST-STYLE-TYPE: none">
<p></p>
</li>
<li>first item
<p>&nbsp;</p>
<p></p>
</li>
<li>second item
<p>&nbsp;</p>
<p></p>
</li>
<li>third item
<p>&nbsp;</p>
</li>
</ol>

Note the extra, empty "<li style=" tag that was inserted, as well as the extra "<p>&nbsp;</p>" code that was inserted for each list item.

5)  If I go back through the listing and edit the HTML to look like:

<ol>
<li>first item
<p></p>
</li>
<li>second item
<p></p>
</li>
<li>third item
</li>
</ol>

And switch back to normal view, I have what I would expect -- a double-spaced list numbered from 1.

It now looks like:

    1.  first item

    2.  second item

    3.  third item


6)  Sometimes (but not consistently), this first time back into the normal view it will look like:

    1.  first item

    2.  second item


    3.  third item

Note the extra blank line space between 2 and 3.  But there is no corresponding HTML code responsible for this.

However, if I switch back-and-forth between "Normal view" and "HTML view" a few times, then the "Normal view" will eventually correct itself and display the list like it should (as listed at the end of step #5).

Kevin
Sunday, October 12, 2003

All you have to do is add <br>&nbsp; at the end of each item. This will give you the extra empty line without upsetting anything.

Jorgen Brenting
Monday, October 13, 2003

If all you want is more space between (below) your list items, there is a better (i.e. W3C recommended) way of doing it: using style sheets.

To add space equivalent to one extra new line below each list item, use the following CSS:

li {
    margin-bottom: 1em;
}

Henrik Jernevad
Monday, October 13, 2003

According to the html spec http://www.w3.org/TR/html401/struct/text.html#edef-P a paragraph can only contain inline elements.  A list element is not an inline element.  So, I think that is why CD is moving your p tags around.

I agree with the suggestion to use a little style coding to set your spacing.  It makes your html simpler too.

Joel Goldstick
Monday, October 13, 2003

Thanks to everyone for all the suggestions.

I agree that changing the style sheet appears to be the best way to go.  I guess I need to read up some on CSS . . .  ;-)

Kevin
Tuesday, October 14, 2003

*  Recent Topics

*  Fog Creek Home