nested Super Lists do not indent in Block editor
-
When editing a page in the block editor, nested Super Lists do not visually indent; they are all displayed at the same level (aligned all the way to the left), making it impossible to see the structure.
(Ditto for the rendered view, but that’s easier to work around with my own CSS, so I care much more about the editor view)
I can reproduce easily as follows:
- Open https://playground.wordpress.net/?plugin=superlist-block (currently Super List Block 0.1.4, WP 6.8.1, Twenty Twenty-Five theme)
- +New > Page
- (click X to skip Choose a pattern)
- Options > Code editor
- Paste the following content:
<!-- wp:paragraph -->
<p>Preceding paragraph</p>
<!-- /wp:paragraph -->
<!-- wp:createwithrani/superlist-block {"listStyle":"ol"} -->
<ol class="wp-block-createwithrani-superlist-block ol"><!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 1</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item -->
<!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2</p>
<!-- /wp:paragraph -->
<!-- wp:createwithrani/superlist-block -->
<ul class="wp-block-createwithrani-superlist-block ul"><!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2.a</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item -->
<!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2.b</p>
<!-- /wp:paragraph -->
<!-- wp:createwithrani/superlist-block {"listStyle":"ol"} -->
<ol class="wp-block-createwithrani-superlist-block ol"><!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2.b.1</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item -->
<!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2.b.2</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item --></ol>
<!-- /wp:createwithrani/superlist-block --></li>
<!-- /wp:createwithrani/superlist-item -->
<!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 2.c</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item --></ul>
<!-- /wp:createwithrani/superlist-block --></li>
<!-- /wp:createwithrani/superlist-item -->
<!-- wp:createwithrani/superlist-item -->
<li class="wp-block-createwithrani-superlist-item"><!-- wp:paragraph -->
<p>Item 3</p>
<!-- /wp:paragraph --></li>
<!-- /wp:createwithrani/superlist-item --></ol>
<!-- /wp:createwithrani/superlist-block -->- click Exit code editor
- Observe that the visual editor shows all three levels of nested lists aligned all the way to the left, making it impossible to see the structure.
- (Optionally click Document Overview to see the structure)
- Publish, and View Page
- Observe that the rendered view likewise shows all three levels of nested lists aligned all the way to the left, making it impossible to see the structure.
Here’s what I think is going on…
In a regular list,
<ul>and<ol>default topadding-left: 40px;in the browser, producing nice indentation.Unfortunately, for e.g. Super List
<ol class="wp-block-createwithrani-superlist-block ol">this desirable behavior gets overridden by the plugin’s inline.wp-block-createwithrani-superlist-block {
--padding:var(--wp--custom--superlist-block--spacing--padding,inherit);
padding:var(--padding);
}which effectively results in
padding:initial;(i.e. 0) since var--paddingis set but empty (our parent element does not have a var--paddingvalue for us to inherit).I don’t understand the reasoning behind the above CSS in the plugin, but I observe that temporarily customizing
.wp-block-createwithrani-superlist-block {
padding: var(--wp--custom--superlist-block--spacing--padding,revert-layer);
}in Firefox Inspector makes the playground environment look much better.
(Note that this customization must be applied directly to
padding; customizing--padding: revert-layeris no good because the browser doesn’t have a default value for the var--padding)
The topic ‘nested Super Lists do not indent in Block editor’ is closed to new replies.