Skip to content

Surprise empty default slot #5567

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

Closed
eddow opened this issue Oct 23, 2020 · 2 comments
Closed

Surprise empty default slot #5567

eddow opened this issue Oct 23, 2020 · 2 comments

Comments

@eddow
Copy link

eddow commented Oct 23, 2020

Is your feature request related to a problem? Please describe.

When a component has a default slot and named slots, the textual line-break between named slots will be considered as the default slot.

Example:
MyComponent:

<slot name="slotA" />
<slot name="slotB" />
<slot>Default value</slot>

Usage:

<MyComponent>
    <div slot="slotA"> ... </div>
    <div slot="slotB"> ... </div>
</MyComponent>

This will define an empty default slot (the '⏎' in </div>⏎<div slot="slotB">) and "Default value" won't be displayed.
In order to use the default of the slot, we need to make sure there is no space between the named slots this way:

<MyComponent>
    <div slot="slotA">
        ...
    </div><div slot="slotB">
        ...
    </div>
</MyComponent>

Describe the solution you'd like
When the default slot value contains only spaces-like, the default should be used as if it was empty

How important is this feature to you?
annoyance-level + I had to search for some time why my slot didn't display

@dimfeld
Copy link
Contributor

dimfeld commented Oct 23, 2020

See #4546

@tanhauhau
Copy link
Member

tanhauhau commented Mar 2, 2021

This should be fixed now in 3.35.0.

See REPL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants