Skip to content

Using p for htmlTag outputs incorrectly #3254

@chicgeek

Description

@chicgeek

Description

I have an XML file that creates a new container. It is using a <p> element, one of the valid element types for htmlTag. Using the move directive, I relocate top.search into this new element.

XML source

The XML:

<?xml version="1.0"?>
<page>
    <body>
        <referenceContainer name="main.content">
            <container name="new.container" htmlTag="p" htmlClass="new-container" />
        </referenceContainer>
        <move element="top.search" destination="new.container" />
    </body>
</page>

HTML output

Expected markup output:

<p class="new-container">
    <!-- top.search -->
</p>

Actual markup output:

<p class="new-container"></p>
<!-- top.search -->
<p></p>

Notes

  • This is on merchant_beta 8 on both our custom theme and Luma.
  • This bug does not occur with some of the other allowed elements I've tested, including div and ul. The block is nested in the new container as expected.
  • The docs specify Any valid HTML 5 tag can be used for htmlTag, though this is not the case currently. This mismatch is partly covered in issue Cant set HtmlTag to "nav" #2549. M2 provides the error: Html tag "aside" is forbidden for usage in containers. Consider to use one of the allowed: dd, div, dl, fieldset, main, header, footer, ol, p, section, table, tfoot, ul.

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