-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Select] Add placeholder support #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange); | ||
|
|
||
| React.useEffect(() => { | ||
| useLayoutEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caught another flashing here that I didn't catch before in the React 18 upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple but effective 👌
Should we start adding simple stories to Chromatic for things like this?
We do, I had a story for no value already, and I have added a example with the placeholder to it. So we have both cases. Let me know if I misunderstood though. |
No you're right, I misread the story location when scanning the diff 👍 |
|
@benoitgrelard trying to implement this placeholder value attr, but it's not working for me. is there somethign else I need to do besides add |
No that's all, but maybe you are using the latest public rather than the latest release candidate? |
|
Hey @benoitgrelard , which version exactly the placeholder prop is available? |
|
Hey @MatheusPires99, it's available in latest release candidates. V1 is going out imminently (should be tomorrow). |
| const context = useSelectContext(VALUE_NAME, __scopeSelect); | ||
| const { onValueNodeHasChildrenChange } = context; | ||
| const hasChildren = props.children !== undefined; | ||
| const hasChildren = children !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the difficult things for me to figure out was that value has to be undefined for the placeholder to be shown. I used to use null or '' for empty (reset) value, and not just missing. I understand it's a wrong habit to have, just want others to be clear about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a veeeery good point, and I just spent 1 hour debugging why my placeholder was not showing up...
* [Select] Add placeholder support Closes radix-ui#1235 * Update chromatic story * PR feedback
Closes #1235