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: When i try to integrate with react application, the slot element contains hidden attribute instead of displaying the content. Note: This stencil component is using scoped element. #5799

Closed
3 tasks done
muthupriyashanmugam opened this issue May 29, 2024 · 9 comments
Labels
ionitron: needs reproduction This PR or Issue does not have a reproduction case URL ionitron: stale issue This issue has not seen any activity for a long period of time

Comments

@muthupriyashanmugam
Copy link

Prerequisites

Stencil Version

v4.7.0

Current Behavior

The stencil component contains the non shadow dom which renders the slot-based element.

The below-mentioned code is added in the component-a

<div><slot name="cta"/></div>

The below-mentioned code is added to the index.html file

<component-a><div slot="cta"></div></component-a>

But the output shown in the react application

<slot name="cta" hidden>click here</slot>

Expected Behavior

The slot element content should shown in the react application if it is a scoped slot element.

System Info

npm version 10.7.0
node version 20.11.1

Steps to Reproduce

Try to include the slot element in the stencil component and include it in the react application.

Code Reproduction URL

https://github.com/muthupriyashanmugam/stencil-issue

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label May 29, 2024
@tanner-reits
Copy link
Member

@muthupriyashanmugam Have you tried using the latest version of Stencil? We've made some changes to slot behavior for scoped components in releases post v4.7.0 (your reported version). For more information, check out this section of the docs on what has been resolved and how to enable these fixes.

@tanner-reits tanner-reits added Awaiting Reply This PR or Issue needs a reply from the original reporter. and removed triage labels May 30, 2024
@muthupriyashanmugam
Copy link
Author

We are using the Stenciljs version ^4.7.0 in the package json. Let me check with the recent version and let you know.

@ionitron-bot ionitron-bot bot removed the Awaiting Reply This PR or Issue needs a reply from the original reporter. label May 30, 2024
@muthupriyashanmugam
Copy link
Author

@tanner-reits I have tried the latest version of stencil v4.18.0 but still it shows the hidden attribute added to the slot element.

Note: we are using the stencil library as a web component and compiling those code as a react component and used as a react npm module in another react application.

When we use the react application, we face this kind of issue.

@muthupriyashanmugam
Copy link
Author

@tanner-reits Any update on this issue?

@tanner-reits
Copy link
Member

@muthupriyashanmugam Can you create a complete reproduction case including the React portions? That way we can be sure to see the same behavior. Also, in your case, are you using the React output target?

@tanner-reits tanner-reits added the ionitron: needs reproduction This PR or Issue does not have a reproduction case URL label Jun 3, 2024
Copy link

ionitron-bot bot commented Jun 3, 2024

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@muthupriyashanmugam
Copy link
Author

@tanner-reits Yes, we are using the react output target option to generate the react component. In our case, the slot is adding the hidden attribute rendering when we use it in the react nextjs application.

I have tried to test this case in a sample react application, it's working fine. Then only I come to know that it may be the react nextjs makes an issue.

@muthupriyashanmugam
Copy link
Author

@tanner-reits Could you please help me to find out the cause for the issue which i am facing is that if i include my stencil scoped component in a nextjs react application as a node module, it's rendering as a shadow-root component.

@ionitron-bot ionitron-bot bot added the ionitron: stale issue This issue has not seen any activity for a long period of time label Jul 5, 2024
Copy link

ionitron-bot bot commented Jul 5, 2024

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.

Thank you for using Stencil!

@ionitron-bot ionitron-bot bot closed this as completed Jul 5, 2024
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ionitron: needs reproduction This PR or Issue does not have a reproduction case URL ionitron: stale issue This issue has not seen any activity for a long period of time
Projects
None yet
Development

No branches or pull requests

2 participants