storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
83.4k stars 9.12k forks source link

[BUG] Addon backgrounds - There is no "Reset background" option #27190

Open yannbf opened 1 month ago

yannbf commented 1 month ago

This is still an issue in storybook 8. There is still no "Reset background" option (as in reset the background to the default of the story).

  1. Go to the Image story: https://next--630511d655df72125520f051.chromatic.com/?path=/story/addons-backgrounds-parameters--image
  2. Select "Clear background", the querystring becomes ...&globals=backgrounds.value:transparent
  3. Go the Gradient story (1 step above in the tree) image
  4. The background of the Gradient story is still cleared instead of the default "gradient" background because the querystring still contains ...&globals=backgrounds.value:transparent

I agree that the title of this issue can be confusing. It's not about the "Clear background" option being wrong, it's about a "Reset background (to default)" option that's missing.

And combined with the weird behavior that the background is carried over to other stories if it is available, but resets to the default background when it's not available in a story. Which we cannot use as a workaround, because we cannot remove the "Clear background" option from the available backgrounds in a story.

Originally posted by @WesselKroos in https://github.com/storybookjs/storybook/issues/14030#issuecomment-2115542632

shilman commented 1 month ago

@tmeasday I think this goes away entirely with global overrides, tho perhaps it's a breaking change