feat(S2): show a console warning when content components are used standalone#9604
Open
reidbarber wants to merge 4 commits intomainfrom
Open
feat(S2): show a console warning when content components are used standalone#9604reidbarber wants to merge 4 commits intomainfrom
reidbarber wants to merge 4 commits intomainfrom
Conversation
snowystinger
reviewed
Feb 4, 2026
reidbarber
commented
Feb 4, 2026
| </svg> | ||
| </CenterBaseline> | ||
| <Text>{children}</Text> | ||
| <span>{children}</span> |
Member
Author
There was a problem hiding this comment.
I guess we probably added this for Skeleton loading capabilities. I can see if we go back to Text and update our hook to detect this instead.
|
Build successful! 🎉 |
snowystinger
reviewed
Feb 4, 2026
| <PickerItem textValue="Emily" id="Emily"><Text>Emily</Text></PickerItem> | ||
| <PickerItem textValue="Amelia" id="Amelia"><Text>Amelia</Text></PickerItem> | ||
| <PickerItem textValue="Isla" id="Isla"><Text>Isla</Text></PickerItem> | ||
| <PickerItem textValue="Eva" id="Eva">Eva</PickerItem> |
Member
There was a problem hiding this comment.
don't need textValue either then?
snowystinger
reviewed
Feb 4, 2026
| export const Heading = forwardRef(// Wrapper around RAC Heading to unmount when hidden. | ||
| function Heading(props: HeadingProps, ref: DOMRef<HTMLHeadingElement>) { | ||
| [props, ref] = useSpectrumContextProps(props, ref, HeadingContext); | ||
| useWarnIfNoStyles('Heading', props); |
Member
There was a problem hiding this comment.
this is just checking props, would it be better to check that there's a context object? otherwise you wont' get the warning sometimes
you could pass the context to retrieve instead of props
useWarnIfNoStyles('Heading', HeadingContext);
then in the hook, useContext(Context) and just check if that returns an object at all
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When content components (
Text,Heading, etc.) are used standalone, they don't inherit any styles. This PR's change will show a warning in this case, so the user knows to use native HTML elements with the style macro instead.This change is also oriented to AI tools that frequently make this mistake, although it seems like they more often look at lint errors instead of browser errors. Not sure this is something we can catch with a lint plugin.
✅ Pull Request Checklist:
📝 Test Instructions:
See unit tests.
🧢 Your Project: