storybookjs / storybook

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

[Bug]: Color control automatically pops up, without triggering the control itself #28511

Open valentinpalkovic opened 2 weeks ago

valentinpalkovic commented 2 weeks ago

Describe the bug

When visiting a story with a color control, the control will automatically open

Reproduction steps

  1. Go to https://634ff0d0ec053b270775979d-vpmrbjlyny.chromatic.com/?path=/story/addons-controls-basics--undefined
  2. In the controls panel, the color picker is automatically opened

image

Additional context

No response

greptile-apps[bot] commented 2 weeks ago

To resolve the issue where the color control automatically opens, ensure that the startOpen prop is correctly set to false by default in the ColorControl component. Check the implementation in Color.tsx and verify the stories in Color.stories.tsx.

  1. In Color.tsx, ensure startOpen is set to false by default:
export const ColorControl: FC<ColorControlProps> = ({
  name,
  value: initialValue,
  onChange,
  onFocus,
  onBlur,
  presetColors,
  startOpen = false, // Ensure this is set to false
  argType,
}) => {
  // ...
};
  1. In Color.stories.tsx, verify that the startOpen prop is not set to true unless explicitly needed:
export const StartOpen: Story = {
  args: {
    startOpen: true, // Only set to true for this specific story
  },
};

This should prevent the color picker from opening automatically unless specified.

References

/code/lib/blocks/src/controls/Color.tsx /code/lib/blocks/src/controls/Color.stories.tsx /code/addons/controls/src/manager.tsx

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/storybookjs/storybook/next) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)