-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Labels in control are hidden when Select used within an expander (collapsed) with a defaultValue. #3406
Comments
@alturium thanks for this issue. The reason this is happening is because Collapse uses the width of the DOM node to manage transition animations. since the is using display:none to hide its children, when measurement happens the width of the element is 0. At the moment I can't think of a simple fix for this within Collapse that wouldn't also compromise its existing functionality. Happy to discuss this further If you do feel strongly about the pattern in your sandbox. Even better, if you have an idea of how to go about resolving the issue, a PR is always greatly appreciated :D |
The example used Expander but in actuality I was using Luckily, I was able to substitute my version of In thinking about it, I can see that the react's DOM is created, and the width computed at that point in time as 0 (zero). Changing props or states themselves do not cause the re-calculation of width in So essentially we are working around a React limitation, using the most essential line below, to force a re-evaluation of the react DOM tree: It may still be possible to re-write the react-select Does this sound correct? |
Running into the same issue. Tried the top answer here, didn't work: facebook/react#4101 I'm trying to use value instead of defaultValue, but that doesn't seem to be working either. If I start with the open state for , defaultValue populates. But if it starts collapsed, defaultValue doesn't populate when the state is toggled on, even though I can see the defaultValue prop is passed down to react-select. UPDATE: |
Thank you @geochanto! This saved me a lot of time. I guess I will just go without animation until this issue is resolved. |
@alturium @muserrefakillibaykus I have not been able to reproduce this even in the sandbox link provided. I am uncertain what if anything has changed, but if someone can replicate this issue please provide some more information so we can reproduce the described error, reopen this issue and further troubleshoot. In the meanwhile given that I am unable to replicate it, I will close it for time being. |
Description
<div>
with a width of 0 (width: 0px).Expected Behavior
There should a label in the control, but instead it is effectively hidden by a width: 0px from a wrapping
<div>
.There is a similar issue: ‘Default selected items don't appear when using transitions if select is hidden #3029’. The discussion in #3029 seems to indicate that the issue has to do with the Collapse component, which stores a ‘width’ in its state (initially set to ‘auto’), but appears it does not get re-computed.
Sandbox
https://codesandbox.io/s/jz4112nvyw
Screenshot
The text was updated successfully, but these errors were encountered: