You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let me preface this ticket by saying that I am not 100% confident that this is actually a bug, but the behaviour does feel unnatural and unexpected.
Describe the bug
When using slots with fallback content inside a component, the rendering of the fallback content is unpredictable, depending on the formatting of the code.
If the opening and closing tag of the component are not on the same line, an empty string appears to be sent to the component, which is interpreted as content, thus not showing the fallback content.
I feel that this does not match the described behaviour for slot fallback content in the API documentation (https://svelte.dev/docs#slot):
The content is exposed in the child component using the element, which can contain fallback content that is rendered if no children are provided.
Both Box 3 and Box 4 are rendered in an empty state, without fallback content.
Expected behavior
I would expect Box 3 and Box 4 to show the same fallback content as Box 1 and Box 2.
Information about your Svelte project:
Svelte version 3.16.3
Severity
I guess this behaviour is mostly annoying, because it can be circumvented, as shown in the example REPL. I do however feel that this workaround defeats the purpose of having the option to specify fallback content.
Additional context
I discussed this issue with Conduitry on Discord and he sent me this ticket, which might be the reason for the current behaviour: #1007
When browsing the open issues, I came across the following suggestion, which might be a way to solve this issue: #3080
The text was updated successfully, but these errors were encountered:
Let me preface this ticket by saying that I am not 100% confident that this is actually a bug, but the behaviour does feel unnatural and unexpected.
Describe the bug
When using slots with fallback content inside a component, the rendering of the fallback content is unpredictable, depending on the formatting of the code.
If the opening and closing tag of the component are not on the same line, an empty string appears to be sent to the component, which is interpreted as content, thus not showing the fallback content.
I feel that this does not match the described behaviour for slot fallback content in the API documentation (https://svelte.dev/docs#slot):
To Reproduce
Please refer to the following code example: https://svelte.dev/repl/f10ecd42506b4603839be1fe1ad8f8d4?version=3.16.3
Both Box 3 and Box 4 are rendered in an empty state, without fallback content.
Expected behavior
I would expect Box 3 and Box 4 to show the same fallback content as Box 1 and Box 2.
Information about your Svelte project:
Severity
I guess this behaviour is mostly annoying, because it can be circumvented, as shown in the example REPL. I do however feel that this workaround defeats the purpose of having the option to specify fallback content.
Additional context
I discussed this issue with Conduitry on Discord and he sent me this ticket, which might be the reason for the current behaviour: #1007
When browsing the open issues, I came across the following suggestion, which might be a way to solve this issue: #3080
The text was updated successfully, but these errors were encountered: