Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light DOM slot forwarding fails to render for duplicated slot names #4446

Closed
nolanlawson opened this issue Aug 7, 2024 · 1 comment · Fixed by #4452
Closed

Light DOM slot forwarding fails to render for duplicated slot names #4446

nolanlawson opened this issue Aug 7, 2024 · 1 comment · Fixed by #4452

Comments

@nolanlawson
Copy link
Collaborator

nolanlawson commented Aug 7, 2024

This is an issue introduced by #4258. It affects light DOM components, and specifically named slots whose slot names are forwarded, and only when those slot names are duplicated in the containing template.

The bug is a bit hard to describe, so it's easier to illustrate with a repro: 5035243

The key component here is header.html:

<template lwc:render-mode="light">
    <div lwc:if={isTablet}>
        <slot name="navigation"></slot>
    </div>
    <div lwc:else>
        <slot name="navigation"></slot>
    </div>
</template>

Note the duplicated slots with the same name (navigation). This is the key thing that triggers the bug when slot forwarding is present. If the condition (in this case isTablet) is toggled, then the content that should be rendered inside of the <slot> is not rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant