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

Global Args / Toolbars: Mechanism to load preview iframe with particular global args configuration #11604

Closed
BPScott opened this issue Jul 18, 2020 · 1 comment

Comments

@BPScott
Copy link

BPScott commented Jul 18, 2020

Is your feature request related to a problem? Please describe.

I would like to be able set the preview iframe into a given global args state. This was possible using addon-controls as it passed values into preview iframe's querystring. However it is not clear how to do that with addon-toolbars / global args.

I want to use chromatic/percy to screenshot a story with different values for global args. This would be useful for visual regression testing a story using multiple multiple themes. (disclaimer: this is currently hypothetical but I've raised feature requests).
I want to pass a list of story preview iframe urls into acessibility checking tools to check that my themes pass contrast checks etc (I am doing this currently).

In storybook 5.3 I can use addon-controls to create a toggle between different visual themes

However when trialing v6 and replacing my addon-controls usage with addon-toolbars, there doesn't seem to be an equivalent functionality for global args.

Describe the solution you'd like

A mechanism to load the preview iframe with a particular global args configuration. At its most simplistic, this could be done by storing the serialised state in a query string parametes, though this may have some limitations depending on if global args can be serialized.

Rather than generalising to all global args this could be limited to just defining an initial addon-toolbars state in the same way as how addon-controls sets the contexts query param as I think that should all be stringy. This would solve my particular use case.

Are you able to assist bring the feature to reality?
no

@shilman
Copy link
Member

shilman commented May 27, 2021

Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-beta.2 containing PR #15056 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed May 27, 2021
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

4 participants