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

Forwarding scoped slot does not map to the correct slot assignment #3889

Closed
jmsjtu opened this issue Dec 5, 2023 · 3 comments
Closed

Forwarding scoped slot does not map to the correct slot assignment #3889

jmsjtu opened this issue Dec 5, 2023 · 3 comments

Comments

@jmsjtu
Copy link
Member

jmsjtu commented Dec 5, 2023

Description

When forwarding a scoped slot to another slot, the slot mapping is incorrect. The scoped slot will always be slotted into the default slot of the component.

Here's a stackblitz demo.

<template lwc:render-mode="light">
  <x-scoped-slot-child>
    <template lwc:slot-data="title">
      <h2>{title}</h2>
    </template>
  </x-scoped-slot-child>
</template>

// x-scoped-slot-parent
<template lwc:render-mode="light">
  <x-leaf>
    <!-- Note slot="foo" doesn't map to <slot name="foo"> in x-leaf -->
    <slot lwc:slot-bind={title} slot="foo"></slot>
  </x-leaf>
</template>

// x-scoped-slot-child

Notice in x-scoped-slot-child, slot="foo" on the slot element.

<template>
  <slot></slot>
  <slot name="foo"></slot>
</template>

// x-leaf

Inspecting the elements, the scoped slot is slotted into the default slot of x-leaf, ignoring the slot attribute in x-scoped-slot-child.

@jmsjtu jmsjtu added the bug label Dec 5, 2023
@jmsjtu
Copy link
Member Author

jmsjtu commented Dec 5, 2023

cc @ravijayaramappa created an issue to track

Copy link

git2gus bot commented Jan 29, 2024

This issue has been linked to a new work item: W-14913824

@jmsjtu
Copy link
Member Author

jmsjtu commented Mar 13, 2024

Fix with #3883

@jmsjtu jmsjtu closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants