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
When I use Material Web Components with Svelte, attributes without value are discarded and thus result in incorrectly styled element. I guess because they are unknown attributes so the default value for them is undefined and thus were removed under the rule "no nullish". Is there a way to keep these attributes as-is, or I have to wrap them inside Svelte component and export the boolean properties corresponding to these attributes?
How to reproduce
npx degit sveltejs/template example-project
cd example-project
npm i
npm add svelte@latest
npm add @material/mwc-button
I've also noticed this issue in the past with other custom element libraries. When in a Svelte context, you have to set boolean attributes on custom elements to a truthy value (e.g. <mwc-button raised=true>) to get them to apply. In a raw HTML context (e.g. the MWC demo page), you can simply add the attribute without setting a value (<mwc-button raised>).
This doesn't happen with native HTML elements -- <button disabled> works just fine inside of Svelte.
geoffrich
added a commit
to geoffrich/svelte
that referenced
this issue
Mar 10, 2021
Description
When I use Material Web Components with Svelte, attributes without value are discarded and thus result in incorrectly styled element. I guess because they are unknown attributes so the default value for them is
undefined
and thus were removed under the rule "no nullish". Is there a way to keep these attributes as-is, or I have to wrap them inside Svelte component and export the boolean properties corresponding to these attributes?How to reproduce
npx degit sveltejs/template example-project cd example-project npm i npm add svelte@latest npm add @material/mwc-button
Change the content of
App.svelte
tothen run with
Other information
The text was updated successfully, but these errors were encountered: