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

Elements with slot attributes can't be naturally rendered via the "light DOM" for DSD components #162

Open
jaredcwhite opened this issue Apr 7, 2023 · 1 comment

Comments

@jaredcwhite
Copy link

jaredcwhite commented Apr 7, 2023

Let's say I have a component my-timeline with a declarative Shadow DOM template, and inside the template it wants to render child components:

<template shadowrootmode="open">
  <h3>Timeline</h3>

  <my-timeline-item>Item 1</my-timeline-item>
  <my-timeline-item>Item 2 <aside slot="info">More Info</aside></my-timeline-item>

  <slot webc:raw></slot> <- other parent content
</template>

<slot></slot>

and the timeline item:

<template shadowrootmode="open">
	<div>---</div>
	<slot webc:raw></slot>
	<div>---</div>
	<slot name="info" webc:raw></slot>
</template>

<slot></slot>

The problem is the aside element for the info slot is getting processed by WebC as its own slot, and not included in the default rendering. I could add <slot name="info"></slot> directly at the bottom of the timeline item component, but then it would just pull in the aside element without the slot attribute which the DSD template expects.

I don't know if there's any way to bypass slot= getting roped into the WebC processing altogether in cases like these.

@jaredcwhite
Copy link
Author

See also: #185

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

No branches or pull requests

1 participant