react-collapsible icon indicating copy to clipboard operation
react-collapsible copied to clipboard

form inputs instantly close Collapsible.

Open zaweb opened this issue 3 years ago • 4 comments

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!

zaweb avatar Aug 01 '22 15:08 zaweb

Hey @zaweb, please can you provide a MRE

karltaylor avatar Aug 01 '22 15:08 karltaylor

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.

zaweb avatar Aug 01 '22 16:08 zaweb

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.

zaweb avatar Aug 01 '22 16:08 zaweb

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!

j-eick avatar Sep 04 '22 16:09 j-eick