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

wrong server-side rendering of attributes with true value when spreading props #9066

Closed
wild-dino opened this issue Aug 2, 2023 · 2 comments

Comments

@wild-dino
Copy link

wild-dino commented Aug 2, 2023

Describe the bug

As is
The combination of prop spreading and passing attributes that should have an explicit true value leads to wrong server-side rendering. The same issue is described here: #6121 but the bug reappears when using the spread props, for example, when passing {...$$restProps}. It seems like this behavior is violated here:

if (value === true) str += ' ' + name;

Expected to be
Render attr="" when the value passed to it is true if it's a boolean attribute. In the case of any other attribute, attr="true" should be rendered instead (as it is when using DOM rendering).

Reproduction

<script>
	let disabled = true;
</script>

<button {...$$restProps} aria-disabled={disabled}>
<slot/>
</button>

Logs

No response

System Info

Doesn't matter for this bug

Severity

annoyance

@devunt
Copy link

devunt commented Apr 11, 2024

I'm having the same issue with aria-selected attribute.

@dummdidumm
Copy link
Member

Fixed in Svelte 5

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