lwc
lwc copied to clipboard
Forwarding scoped slot does not map to the correct slot assignment
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
.
cc @ravijayaramappa created an issue to track
This issue has been linked to a new work item: W-14913824
Fix with #3883