Opened 7 weeks ago

Closed 6 weeks ago

#31160 closed Bug (fixed)

admin base.css styling breaks nested ordered list numbering in admindocs

Reported by: Owen T. Heisler Owned by: Owen Heisler
Component: contrib.admindocs Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Summary

Ordered lists are mistakenly styled with list-style-type: square when nested inside an unordered list. Thus, if an ordered list is nested inside an unordered list in a docstring, it is rendered incorrectly by admindocs. This is caused by the CSS rule in base.css, line 97:

ul li { list-style-type: square; }

Example

# models.py
class Store(models.Model):
    """
    This model represents a store that has products available.

    - Unordered list item 1

      1. Ordered sub-list item 1

      2. Ordered sub-list item 2

    """
    pass

Expected behavior when rendered in browser:

  • Unordered list item 1
    1. Ordered sub-list item 1
    2. Ordered sub-list item 2

Actual behavior when rendered in browser:

  • Unordered list item 1
    • Ordered sub-list item 1
    • Ordered sub-list item 2

Solution

The CSS should apply only to list items directly inside an unordered list like this:

ul > li { list-style-type: square; }

See pull request: https://github.com/django/django/pull/12307

Change History (3)

comment:1 Changed 7 weeks ago by Nick Pope

Owner: changed from nobody to Owen Heisler
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 weeks ago by zhou_wuji

Triage Stage: AcceptedReady for checkin

comment:3 Changed 6 weeks ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 77d335e:

Fixed #31160 -- Fixed admin CSS for ordered lists' descendants in unordered list.

Note: See TracTickets for help on using tickets.
Back to Top