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: scoped: true slot fallback is hidden when using slot forwarding #6170

Closed
3 tasks done
johnjenkins opened this issue Feb 21, 2025 · 1 comment · Fixed by #6171
Closed
3 tasks done

bug: scoped: true slot fallback is hidden when using slot forwarding #6170

johnjenkins opened this issue Feb 21, 2025 · 1 comment · Fixed by #6171
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted

Comments

@johnjenkins
Copy link
Contributor

Prerequisites

Stencil Version

latest

Current Behavior

Using a non-shadow component like:

<parent-component label="a label via prop"></parent-component>

Build with a parent:

@Component({
  tag: "parent-component",
  scoped: true,
})
export class ParentComponent {
  @Prop() label: string;

  render() {
    return (
      <Host>
        <child-component label={this.label}>
          <slot name="label" />
          // ^^^ this slot will act as a slotted node, hiding the fallback content
        </child-component>
      </Host>
    );
  }
}

and a child:

@Component({
  tag: "child-component",
  scoped: true,
})
export class ChildComponent {
  @Prop() label: string;

  render() {
    return (
      <Host>
        <div>
          <slot name="label">{this.label}</slot>
          // ^^^ This slot fallback will be hidden
        </div>
      </Host>
    );
  }
}

The nested slot fallback will be hidden

Expected Behavior

Forwarding a slot should not act like slotting a node - the fallback content should not be hidden.

System Info

Steps to Reproduce


Code Reproduction URL

/~https://github.com/johnjenkins/broken-slot-fallback-forwarding

Additional Information

No response

@christian-bromann
Copy link
Member

A patch for this has been released in v4.27.0.

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 Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants