Skip to content

Fix: Correct nested list markers in Latest Posts and Post Content#77613

Open
dpmehta wants to merge 1 commit intoWordPress:trunkfrom
dpmehta:fix/list-style-mismatch-issue
Open

Fix: Correct nested list markers in Latest Posts and Post Content#77613
dpmehta wants to merge 1 commit intoWordPress:trunkfrom
dpmehta:fix/list-style-mismatch-issue

Conversation

@dpmehta
Copy link
Copy Markdown
Contributor

@dpmehta dpmehta commented Apr 23, 2026

What?

Closes #63604

Fixes an issue where unordered lists nested inside the Latest Posts block and the Post Content block displayed the incorrect sequence of list item markers.

Why?

Browsers natively track list nesting to sequence markers (disc -> circle -> square). However, because blocks like Latest Posts and Post Template use <ul> or <li> wrappers for their outer structure, any List Block placed inside them is interpreted by the browser as an already nested list, immediately applying circle to the first level.

A previous fix attempted this by explicitly applying list-style-type to all <li> elements within these block wrappers. But selecting the <li> also overrode the inherited styles and defaults of ordered lists (<ol>), which meant that user-selected list styles like upper-roman or lower-alpha didn't work.

How?

The CSS rules for .wp-block-latest-posts__post-full-content and .wp-block-post-content have been updated to target ul > li rather than just li or ul.

By strictly targeting list items that are direct children of unordered lists (ul > li), we explicitly reset the marker sequence ( as mentioned above ) for unordered lists and forcefully override the browser's User Agent styles. Importantly, this syntax completely ignores <ol> list items. Ordered lists will now correctly preserve their browser defaults (decimal) or user-defined inline styles.

Testing Instructions

  1. Create a new post.
  2. Add a list block. Example:
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>One: disc<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>nested: circle<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>two levels: square<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>three levels: square</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
  1. Add a latest posts block.
  2. Enable the post content option, and select "show full post".
  3. Set the number of items to 1.
  4. Verify: The first level of the unordered list should display a solid disc, the second level an open circle, and the third a square.
  5. Verify: The ordered list should preserve its custom numbering sequence (e.g., I, II, III) and not be incorrectly forced to disc.

Screenshots or screencast

Before

Screenshot 2026-04-23 at 5 54 07 PM

After

Screenshot 2026-04-23 at 5 50 22 PM

Use of AI Tools

AI used to draft PR description.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Apr 23, 2026
@dpmehta dpmehta marked this pull request as ready for review April 23, 2026 13:08
@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

2 similar comments
@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @dickmoomaw, @nickasd.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: dickmoomaw, nickasd.

Co-authored-by: dpmehta <mehtadev@git.wordpress.org>
Co-authored-by: Rishit30G <rishit30g@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List type style (list bullet) is different when nested inside another list

1 participant