Skip to content

[bug]: Block editor/renderer: Nesting a list inside of a list-item leads to invalid/inaccessible HTML #57

Open
@HendrikSchmidt

Description

@HendrikSchmidt

What version of @strapi/blocks-react-renderer are you using?

  • npm@10.9.0
  • Node@20.17.0
  • @strapi/blocks-react-renderer@1.0.1
  • @strapi/strapi@5.5.0
  • react@18.3.1
  • Browser Chrome@131

What's Wrong?

When creating a nested list in Strapi, it will be rendered as invalid HTML with list (ul/ol) elements as direct children of other list elements, instead of being children of list-items li.

Input:

* Test
    * Test

Output:

<ul>
    <li>Test</li>
    <ul>
        <li>Test</li>
    </ul>
</ul>

I am not sure whether this is an issue with @strapi/blocks-react-renderer or strapi itself though. Let me know if I should raise the issue with strapi.

To Reproduce

Create a nested list in the blocks-editor in Strapi and render it with the blocks-react-renderer.

image image

Expected Behaviour

The list should be wrapped inside a list-item:

<ul>
    <li>Test</li>
    <li>
        <ul>
            <li>Test</li>
        </ul>
    </li>
</ul>

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions