You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The configured controls.sort mode (introduced in Storybook 6.2.x) is not adhered to by the props table on the "Docs" tab. Sort mode has been configured per the docs, with the sort mode defined in .storybook/preview.js (as below) to globally set controls sort mode:
Note that setting the sort mode directly within the *.stories.* file exhibits the same issue.
Also note I've observed this using TypeScript with React + Storybook; I'm not sure if the same behaviour is exhibited for non-TS component libraries as I haven't tested, but I can't imagine this being a problem specific to TypeScript.
Requires a React Storybook component library with the Docs addon.
Create a component or type interface with a mix of required and optional props which are not alphabetically (or otherwise) sorted.
Set a controls.sort mode either in your stories file or globally using preview.js.
Observe that the "Canvas" tab presents all props (args/controls) sorted correctly by the given sort mode.
Observe that the "Docs" tab presents all props sorted as they are defined in the component, ignoring the specified sort mode.
Expected behavior
Args/controls in the props table on the "Docs" tab should adhere to the configured controls.sort mode.
Screenshots
Controls from "Canvas" tab (correctly sorted using requiredFirst sort mode):
Same controls from "Docs" tab (incorrectly sorted):
Code snippets
Please refer to the reproduction repository I've provided. It's based on a component library I work with but heavily stripped back to demonstrate the issue clearly.
Describe the bug
The configured
controls.sort
mode (introduced in Storybook 6.2.x) is not adhered to by the props table on the "Docs" tab. Sort mode has been configured per the docs, with the sort mode defined in.storybook/preview.js
(as below) to globally set controls sort mode:Note that setting the sort mode directly within the
*.stories.*
file exhibits the same issue.Also note I've observed this using TypeScript with React + Storybook; I'm not sure if the same behaviour is exhibited for non-TS component libraries as I haven't tested, but I can't imagine this being a problem specific to TypeScript.
To Reproduce
Reproduction repository
Steps to reproduce the behavior:
controls.sort
mode either in your stories file or globally usingpreview.js
.Expected behavior
Args/controls in the props table on the "Docs" tab should adhere to the configured
controls.sort
mode.Screenshots
Controls from "Canvas" tab (correctly sorted using
requiredFirst
sort mode):Same controls from "Docs" tab (incorrectly sorted):
Code snippets
Please refer to the reproduction repository I've provided. It's based on a component library I work with but heavily stripped back to demonstrate the issue clearly.
System
Let me know if this is expected behaviour, or if there's anything further I can provide to help progress this issue!
┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: