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

@storybook/addon-knobs not rendering Dropdowns and Text areas as expected in 4.0.0 #4621

Closed
mbellary-chwy opened this issue Oct 29, 2018 · 3 comments

Comments

@mbellary-chwy
Copy link
Contributor

When I started updating @storybook/addon-knobs version to 4.0.0, observed some issues with Dropdowns and Text areas of addon-knobs.

Issue with Dropdowns:

I am trying to do something like below:

import { select } from '@storybook/addon-knobs';

And in my story, I am adding knobs with dropdowns like:

select('Dropdown 1', ['', 'top', 'bottom'], 'top')

Here I am using options of Array type. On using options of Array type, the rendered dropdowns just have a output of k value like below:

screen shot 2018-10-29 at 4 17 21 pm

If I use options of Object type then it works fine. It does not work fine with Array type only. I guess that is happening because of the reduce function used in the file @storybook/addon-knobs/src/components/types/Select.js like:

options.reduce((acc, k) => Object.assign(acc, { k }), {})

Issue with TextAreas:

I am trying to do something like below:

import { text } from '@storybook/addon-knobs';

And in my story, I am adding knobs with text areas like:

text('message', '<ul><li>This is some lorem ipsum foo bar content.</li></ul>')

Above text is not escaping the html tags. Screenshot for the same is:

screen shot 2018-10-29 at 4 18 11 pm

@diagramatics
Copy link
Contributor

diagramatics commented Oct 30, 2018

Re: dropdowns, you're absolutely right, that was it. #4560 was the duplicate to your issue and I made the fix earlier (#4586), it just hasn't landed in 4.0.0.

Re: text knob, I'm not sure I get what you mean? The text is escaped (and probably should). If you're talking about the output in the story itself being escaped instead of showing as a rendered list, try this out as opposed to withKnobs:

withKnobsOptions({
  escapeHTML: false,
})

@stale
Copy link

stale bot commented Nov 20, 2018

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!

@stale stale bot added the inactive label Nov 20, 2018
@stale stale bot removed the inactive label Nov 25, 2018
@shilman
Copy link
Member

shilman commented Nov 25, 2018

This got fixed in 4.0.1, closing!

@shilman shilman closed this as completed Nov 25, 2018
@shilman shilman added the bug label Nov 25, 2018
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

3 participants