-
Notifications
You must be signed in to change notification settings - Fork 794
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: Slot-Fallback hidden when newlines exists #6129
Comments
hey! Thanks for raising the issue. I don't think this is a stencil issue per se', rather just how custom elements / slots are implemented by default. I downgraded your project to stencil 3 and the 'problem' remains What would happen if you wanted to slot an empty space? (e.g. you slot whatever a user types into an input) Some references: |
Ah ok, thank you - that makes it clearer! But it does mean we have to have a different conversation :D ... Stencil's proprietary slot code now correctly follows / mimics it's native counterpart. I'll leave it to @christian-bromann to think about whether Stencil should break from convention or not. |
IMHO we should strictly follow web standards here and don't break from any conventions as this will be hard to document and maintain over time. @dutscher do you see a way how we can enhance Stencil with a feature instead to simplify the use case you are working with? Maybe custom Stencil properties to the |
it's tricky 'cos there's not even a potential spec to think about or work from. |
That's what I had in mind as well. Alternatively we could introduce a Stencil option that allows to defines specific behavior flags for specific components. This would keep the feature more within Stencils API realm rather than extending one we don't control (e.g. what if the webcomponent spec introduces the same attribute with a different meaning, it also could get user confused as they don't immediately connect this flag to be Stencil specific). |
the cheers |
Prerequisites
Stencil Version
4.23+
Current Behavior
Hi there,
i encounter a bug with the latest version 4.25.1, but the issue comes from 4.23.1 #6082. And the correct addition see here the the comment https://github.com/johnjenkins/stencil/blob/2c607c6407f9ed2a256ec85973e1c6384b701d21/src/runtime/slot-polyfill-utils.ts#L10
The problem is:
Due whitespace/newlines in the default slot is the which gets and its hidden.
Here is everything fine:
<s-text-field><span slot="label">Label</span></s-text-field>
Here we have an empty which get and its not hidden.
Expected Behavior
is visible with empty default slot with newlines and whitespaces.
System Info
Steps to Reproduce
The render method ot this stencil component looks like this:
Code Reproduction URL
https://codesandbox.io/p/devbox/slot-bug-reproduce-6hhnwj
Additional Information
The slot fallback ist needed to get a external <input into the webcomponent:
Cheers and thanks for your hard work!
The text was updated successfully, but these errors were encountered: