react-collapsible
react-collapsible copied to clipboard
form inputs instantly close Collapsible.
I have a form that appears when the Collapsible is opened. The Collapse is instantly closed whenever any key is pressed in any field. This makes filling out a collapsible form impossible. My field inputs use a simple onChange handler, so it's unclear why any keystroke triggers the Collapsible to close. Is this expected behavior? Thank you!
Hey @zaweb, please can you provide a MRE
Hmm... Unfortunately, I can't reproduce it on jsfiddle. Figures. I wonder if it's something to do with reactstrap... I'll see if I can work around it on my own since I can't give you much to work with. Thank you.
If it helps, here's where I'm having the problem:
<CInput
name={`foos[${index}].${key}`}
value={foo[key]}
onChange={(e) => {handleUpdateProperty(`foos[${index}].${key}`, e.target.value, 'foos') }}
/>
If I remove "value={foo[key]}" then it works fine. But if it's in there, it instantly closes on any keystroke in an input field.
I have a form that appears when the Collapsible is opened. The Collapse is instantly closed whenever any key is pressed in any field. This makes filling out a collapsible form impossible. My field inputs use a simple onChange handler, so it's unclear why any keystroke triggers the Collapsible to close. Is this expected behavior? Thank you!
Thank you so much for your post. I wanted to use this package for a formular as well.
Question: My form has 5 input fields with one submit button at the end. Would a click into the second input field (after filling out the first one) close the collapsible? If I understood your post correctly, then this is the case. Can you confirm?
Thanks in advance!