Skip to content

Conversation

@dsmmcken
Copy link
Contributor

Grid and Flex share the defaults doc strings set for justifyContent, alignContent and alignItems, from BoxAlignmentStyleProps. However, no such defaults are actually set by the components, they are just passthroughStyle props for grid and normalize flex-start/start flex-end/end for flex, but neither explicitly set the stated defaults. They resolve in as just normal computed styles by the browser.

The doc string is misleading, and should be removed. My guess was the defaults were written as such to reference the fast that a browsers "normal" setting behaves similar to the defaults mentioned, so maybe that's why they were added? Or maybe at one point those were the defaults? However, claiming to set a default in the doc string, when it is not in the component is confusing.

Doc strings shown as default:
image

Defaults not actually set:
image

PR removes the docstring only, component behaviour is as current (no default).

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense.

My guess was the defaults were written as such to reference the fast that a browsers "normal" setting behaves similar to the defaults mentioned

This is correct, though, as you noted, 'normal' doesn't exactly equal these values and so they are currently a little misleading.

Note, in the next iteration of our React Spectrum library, S2, Flex and Grid won't exist anymore. As knowledge and comfort using flex and grid has grown, these have become unnecessary. Access to variables to set spacing, etc, will be useable through our style macros theme.
https://react-spectrum.adobe.com/s2/index.html?path=/docs/migrating--docs#flex

@snowystinger snowystinger added this pull request to the merge queue Mar 28, 2025
Merged via the queue into adobe:main with commit 3c9b36a Mar 29, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants