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

bug: Missing slotted content when slot is forwarded from a non-shadow component #4525

Closed
3 tasks done
asik opened this issue Jun 28, 2023 · 2 comments · Fixed by #4940
Closed
3 tasks done

bug: Missing slotted content when slot is forwarded from a non-shadow component #4525

asik opened this issue Jun 28, 2023 · 2 comments · Fixed by #4940
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil slot-related

Comments

@asik
Copy link

asik commented Jun 28, 2023

Prerequisites

Stencil Version

4.0.0 (also seen in 3.4.0)

Current Behavior

I'm not sure exactly what the problem is here, but basically I have a component with this structure:

@Component({
  tag: 'non-shadow-host',
  shadow: false,
})
export class NonShadowHost {
  render() {
    return (
      <div>
        <drop-down>
          <slot name="main-content" slot="main-content" />
          <div slot="dropdown-content-element">
            <drop-down-content>
              <slot name="dropdown-content" />
            </drop-down-content>
          </div>
        </drop-down>
      </div>
    );
  }
}

(the name drop-down is meaningless, I stripped out all code related to that). If I set shadow: true, this works, if I remove it, the slotted content in "dropdown-content" doesn't render. In the following screenshot, the selected node should get slotted but doesn't, and doesn't show up in the rendered HTML.

image

I made a copy of this component, changed the name for shadow-host and set shadow to true, and now it renders as expected.

image

image

I'm not sure if I'm trying to do something unsupported here, but I didn't see any warnings in the documentation about interop between shadow and non-shadow components.

Expected Behavior

I would expect both components to end up rendering the same thing on screen.

System Info

No response

Steps to Reproduce

Clone the linked repo
yarn && yarn start
Check out example 2 labeled Missing slotted content bug in index.html.

Code Reproduction URL

https://github.com/asik/stencil-repro

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jun 28, 2023
@rwaskiewicz rwaskiewicz added Bug: Validated This PR or Issue is verified to be a bug within Stencil slot-related labels Jul 19, 2023
@ionitron-bot ionitron-bot bot removed the triage label Jul 19, 2023
@rwaskiewicz
Copy link
Member

Thanks @asik! The reproduction case helps immensely! I believe this has something to do with the differing values of shadow between 'drop-down-content' and 'non-shadow-host'. I've labeled this to get ingested into our backlog and as a part of the larger effort to fix up bugs related to slots in Stencil. Thanks again!

@rwaskiewicz
Copy link
Member

The fix for this issue has been released as a part of today's Stencil v4.7.0 release. Should the issue reappear, please feel free to open a new ticket. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil slot-related
Projects
None yet
2 participants