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

Knobs not working for iframe (Storybook v6) #22

Open
abeledovictor opened this issue Aug 26, 2020 · 12 comments
Open

Knobs not working for iframe (Storybook v6) #22

abeledovictor opened this issue Aug 26, 2020 · 12 comments

Comments

@abeledovictor
Copy link

Describe the bug
Knobs via url are not being set for iframe view on storybook. Tested in safari and chrome, the bug happens intermittently.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any story with knobs
  2. Change some knobs for that story
  3. Open iframe view
  4. Knobs changed are not reflected on iframe view

Expected behavior
Knobs changed are reflected on iframe view

System:

Environment Info:

System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Binaries:
Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 6.14.6 - ~/.nvm/versions/node/v12.18.2/bin/npm
Browsers:
Chrome: 84.0.4147.135
Firefox: 77.0.1
Safari: 13.1
npmPackages:
@storybook/addon-a11y: ~6.0.13 => 6.0.19
@storybook/addon-console: ~1.2.1 => 1.2.1
@storybook/addon-essentials: ~6.0.13 => 6.0.19
@storybook/addon-events: ~6.0.13 => 6.0.19
@storybook/addon-knobs: ~6.0.13 => 6.0.19
@storybook/addon-links: ~6.0.13 => 6.0.19
@storybook/addon-storysource: ~6.0.13 => 6.0.19
@storybook/addons: ~6.0.13 => 6.0.19
@storybook/client-logger: ~6.0.13 => 6.0.19
@storybook/react: ~6.0.13 => 6.0.19
@storybook/theming: ~6.0.13 => 6.0.19

Knobs on iframe were working with the first migration to version 6

@shilman
Copy link
Member

shilman commented Aug 27, 2020

FYI, we’ve released addon-controls in Storybook 6.0. Controls are portable, auto-generated knobs that are intended to replace addon-knobs long term.

Please upgrade and try them out today!

@shilman
Copy link
Member

shilman commented Aug 27, 2020

Can you bisect to figure out which version broke it?

@abeledovictor
Copy link
Author

The problem with controls is that they don't have a way to set their values via URL params and we are using that feature for e2e testing. Is there any plan in place to add that feature?

I'll try to find the specific version which breaks the knobs.

@shilman
Copy link
Member

shilman commented Aug 28, 2020

@abeledovictor yup, we're planning to add URL support for both args and globals, hopefully in 6.1: storybookjs/storybook#12291 storybookjs/storybook#11604

Thanks for tracking down the knobs break

@metasean
Copy link

Possibly related, the storybook-addon-preview uses knobs as the basis for their preview.

The display only shows the Controls panel values, but the preview code is based solely on the Knobs panel values, which will be really problematic for our designers.

Is there any way that we can have a transition period where Storybook devs can exclusively use Knobs instead of Controls, while plug-in devs upgrade their plug-ins to use Controls?

@shilman
Copy link
Member

shilman commented Aug 31, 2020

@metasean why? our plan is to deprecate knobs and replace them with controls. we're giving notice now so that it doesn't come as a surprise. in the meantime knobs are not deprecated and you're welcome to use them.

@metasean
Copy link

@shilman - There are two immediate reasons. First, while we can still use Knobs in v6, they aren't displaying in the iframe (hence, why I added my comment to this issue instead of opening another one) and second, the Controls panel still displays (at least, I haven't found a config setting to turn off the display), which effectively makes the storybook-addon-preview and by extension, Storybook, not particularly useful for our target audience until the addon is upgraded to use the v6 Controls.

(I really liked that the Controls came by default with a new v6 repo, and feel confident that plugins will upgrade, but until they do, having Knobs continue to completely work, including working in the iframe, is important. Specifically, I'd much rather have to adapt to Knobs in an otherwise v6 Storybook, then to have to spin up a new v5 repo, only to have to update it to v6 further down the line.)

@shilman
Copy link
Member

shilman commented Sep 2, 2020

@metasean you can disable controls if you don't want to use them

https://storybook.js.org/docs/react/essentials/introduction#disabling-addons

@inthegreenwild
Copy link

inthegreenwild commented Sep 13, 2020

@metasean you can disable controls if you don't want to use them

https://storybook.js.org/docs/react/essentials/introduction#disabling-addons

This disables the "controls" tab but the "knobs" tab is still missing

Edit: it shows up if I add it to the main "composer" of all the other storybooks. Is this expected behavior? If the main storybook doesn't have an add-on, a child using that add-on won't have access to it?

@shilman
Copy link
Member

shilman commented Sep 13, 2020

@inthegreenwild sounds like that could be a bug with the new composition feature. any chance you can file an issue with a public repro?

@inthegreenwild
Copy link

@stale
Copy link

stale bot commented Oct 12, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@shilman shilman transferred this issue from storybookjs/storybook May 10, 2021
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

4 participants