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

[Bug]: Attributes that are mapped to boolean properties are shown with quotes inside the "Show code" section. #26393

Open
peschee opened this issue Mar 9, 2024 · 10 comments

Comments

@peschee
Copy link
Contributor

peschee commented Mar 9, 2024

Describe the bug

IS

<button type="button" primary="">Button</button>

SHOULD

<button type="button" primary>Button</button>

To Reproduce

https://stackblitz.com/edit/github-tk7nc8

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.0.0-beta.5 => 8.0.0-beta.6 
    @storybook/addon-links: ^8.0.0-beta.5 => 8.0.0-beta.6 
    @storybook/blocks: ^8.0.0-beta.5 => 8.0.0-beta.6 
    @storybook/test: ^8.0.0-beta.5 => 8.0.0-beta.6 
    @storybook/web-components: ^8.0.0-beta.5 => 8.0.0-beta.6 
    @storybook/web-components-vite: ^8.0.0-beta.5 => 8.0.0-beta.6 
    storybook: ^8.0.0-beta.5 => 8.0.0-beta.6

Additional context

Using the latest storybook.new Lit + TS template

@arp55
Copy link

arp55 commented Mar 22, 2024

This is showing as expected now.

image

@peschee
Copy link
Contributor Author

peschee commented Mar 22, 2024

@arp55 What do you mean with "now"? Since what version? I can test in my repro.

@arp55
Copy link

arp55 commented Mar 22, 2024

I checked in the latest. Unable to reproduce.

@peschee
Copy link
Contributor Author

peschee commented Mar 25, 2024

@arp55 Doesn't work in my repro when updating to 8.0.4 unfortunately…

Component is using Lit and defines the primary attribute inside the html tagged template literal as:

?primary=${ifDefined(primary)}

the show code section still shows

<button type="button" primary=""…

@ajeetchaulagain
Copy link

It's showing with quotes as well for me with latest (8.0.5)

@sossost
Copy link
Contributor

sossost commented Apr 18, 2024

hi @vanessayuenn. I am sossost, a new contributor. Can I fix this??

@ChelseaChilders
Copy link

I can confirm this is happening to me as well. Looking for a fix

@vanessayuenn
Copy link
Contributor

@sossost Please go ahead! Be sure to check the contribution guide and hop onto the Storybook Discord if you need any help getting started. Looking forward to your contribution! ✨

@psychobolt
Copy link

I have the same issue on v8.1.11

@emersonbottero
Copy link

Also having the same issue

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

No branches or pull requests

8 participants