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

Svelte 5: Some boolean attributes are incorrectly rendered with <svelte:element>. #12664

Closed
Serator opened this issue Jul 30, 2024 · 4 comments · Fixed by #13327
Closed

Svelte 5: Some boolean attributes are incorrectly rendered with <svelte:element>. #12664

Serator opened this issue Jul 30, 2024 · 4 comments · Fixed by #13327
Labels
Milestone

Comments

@Serator
Copy link

Serator commented Jul 30, 2024

Describe the bug

Related to #12643 and #12649.

https://github.com/sveltejs/svelte/pull/12649/files#diff-87ec8cbb1aa898b9a6bc0e9dde2e355df357844becd562b80386d0bf4713b57fR344-R345 - there are other HTMLElement properties. Here's a possibly incomplete list:

Either way, new properties / attributes will be added over time.

Reproduction

Reproduction link

image

Logs

No response

System Info

Svelte 5.0.0-next.202

Severity

annoyance

@dummdidumm dummdidumm added this to the 5.0 milestone Jul 30, 2024
@dummdidumm
Copy link
Member

Giving this the 5.0 milestone because it works in Svelte 4 - likely because since #11371 we get more properties (which fixes other bugs that Svelte 4 has), so we need to enhance that list we have

@dummdidumm dummdidumm added the bug label Jul 30, 2024
@paoloricciuti
Copy link
Member

Some of those also are kinda different from draggable...hidden for example is a "boolean attribute": you can't set hidden="false", it will still be hidden because the attribute is present. Same thing with inert even if it's correctly set as false it will still be inert. Same autofocus.

Also contenteditable seems to actually correctly reflect the value even in your screenshot.

We definitely want the change for translate and spellcheck

@dummdidumm
Copy link
Member

You're right, those are actually correct, and setting them to the string false is different to setting it to a boolean (or falsy) value.

I also don't quite understand the problem with translate and spellcheck - what is the problem with them? The look correct.

So in summary, all of those are actually fine?

@paoloricciuti
Copy link
Member

You're right, those are actually correct, and setting them to the string false is different to setting it to a boolean (or falsy) value.

I also don't quite understand the problem with translate and spellcheck - what is the problem with them? The look correct.

So in summary, all of those are actually fine?

translate and spellcheck have probably the same problem of draggable...they are setters on the element so if you try to do element.spellcheck="string" it treat that string as a truthy value and set spell check to "yes" even if the string was "no"...the fix is the adding those attributes to the list of attributes for which we always want to use setAttribute. All the rest seems fine to leave it like this imho.

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