Skip to content

ContentPicker: invalid html #400

@saulirajala

Description

@saulirajala

Describe the bug

There will be Warning: validateDOMNesting(...): <div> cannot appear as a child of <tr>. in console, when adding items to ul.block-editor-link-control__search-items

This happens because the component uses <TreeGridRow><PickedItemContainer> -structure where <PickedItemContainer> is just div. See https://github.com/10up/block-components/blob/develop/components/content-picker/PickedItem.tsx#L27

TreeGrid and related components should be used in <TreeGrid><TreeGridRow><TreeGridCell> -structure, which will render valid html structure for <table>. See https://developer.wordpress.org/block-editor/reference-guides/components/tree-grid/

Also there is invalid html structure in the ul.block-editor-link-control__search-items element, which has div-element as children. This is not allowed according to the specs https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ul#technical_summary

Image

Steps to Reproduce

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions