Fix: Correct nested list markers in Latest Posts and Post Content#77613
Fix: Correct nested list markers in Latest Posts and Post Content#77613dpmehta wants to merge 1 commit intoWordPress:trunkfrom
Conversation
…ck and post content block
|
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.
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
|
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.
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. |
|
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.
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. |
|
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 Unlinked AccountsThe 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. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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 applyingcircleto the first level.A previous fix attempted this by explicitly applying
list-style-typeto 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 likeupper-romanorlower-alphadidn't work.How?
The CSS rules for
.wp-block-latest-posts__post-full-contentand.wp-block-post-contenthave been updated to targetul > lirather than justliorul.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
disc, the second level an opencircle, and the third asquare.disc.Screenshots or screencast
Before
After
Use of AI Tools
AI used to draft PR description.