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: Incorrect slotting with Angular's conditional rendering, 'shadow:false' and named slots. #6043

Open
3 tasks done
raqushque opened this issue Nov 7, 2024 · 4 comments
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted

Comments

@raqushque
Copy link

raqushque commented Nov 7, 2024

Prerequisites

Stencil Version

Tested with 2.22.3 and 4.22.2

Current Behavior

Elements are being "slotted" incorrectly into components with 'shadow:false' when added at runtime (with Angular's @if, for example).

Elements are inserted into default slot if it exists and as a first child of component if it does not.

Components with 'shadow:true' function as expected.

Expected Behavior

Elements are "slotted" into correct location (same as when using component with shadow: true)

System Info

No response

Steps to Reproduce

Clone the repo
https://github.com/raqushque/stencil-ng-slots-repro

  • run npm i --legacy-peer-deps
  • run npm run start

In app click the buttons Toggle content or Push to array. These add content that should be slotted.

Code Reproduction URL

https://github.com/raqushque/stencil-ng-slots-repro

Additional Information

This is likely not a Stencil issue, but rather some sort of conflict between Stencil and Angular. Still, since @stencil/angular-output-target exists I'd expect component to work properly in both shadow and non-shadow modes, or this issue be documented. Also, default slots do work, so there could be a solution/workaround on Stencil's side.

@ionitron-bot ionitron-bot bot added the triage label Nov 7, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted and removed triage labels Nov 26, 2024
@cgomezgu
Copy link

cgomezgu commented Dec 3, 2024

Hi @ionic-team,
we're facing the same Bug in a Project with conditionally rendered slots, after we updated to ios18/macOS15: After an element renders a conditionally slot element, other slot elements on the same page gets removed.

This only seems to occur with elements whose slots have display: contents and contain text nodes. If you set the slot to e.g. display: block or wrap the text in an element such as span, p or div, the error does not occur.

In his example that would mean using <my-headline><span>Headline</span></my-headline> in my-app.ts would work.

Angular 17, Stencil 4.22, Safari 18.X.X.
Shadow: true.

url report: https://www2.webkit.org/show_bug.cgi?id=280399#c2

Thanks!

@christian-bromann
Copy link
Member

@cgomezgu thank you for validating. Any contributions that help fix this issue are greatly appreciated.

@cgomezgu
Copy link

Hi @christian-bromann, Is there any revision estimate? Is it one of your short-term plans to review the incident?

@christian-bromann
Copy link
Member

Is there any revision estimate?

No.

Is it one of your short-term plans to review the incident?

At OutSystems we have limited resources and rely on contributions from the outside. If you are impacted by this problem, the best thing would be to get involved and help resolve it. This is not an "incident", I see this as a bug in an open source project that can be resolved by anyone who is impacted by it.

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

No branches or pull requests

3 participants