It seems that enabling "collapsed by default" for a multi-valued entity reference field causes the inline entity form widget to collapse whenever the form is updated, except for two situations:
- Clicking "Add new item" for the first inline entity in the form.
- Clicking "Add existing item" for the first inline entity in the form.

Steps to Reproduce

  1. Create a content type that has an entity reference field.
  2. Configure the entity reference field to use the "Complex" IEF widget.
  3. Configure the widget with the following enabled:
    • Collapsible.
    • Collapsed by default.
    • Allow users to add new entities.
    • Allow users to add existing entities.
  4. Open the content creation form for the content type created in step 1.
  5. Expand the collapsed fieldset for the field created in step 2.
  6. Click "Add new item" on the field created in step 2.
  7. Fill out the form and click the "Save" button inside the IEF form (i.e. not the one for the whole form, just the one for the child form).
  8. Do any of the following:
    • Click "Edit" next to the item that was added in step 7; OR
    • Click "Remove" next to the item that was added in step 7; OR
    • Click "Add new item"; OR
    • Click "Add existing item"

Expected Results

The fieldset should stay open after step 5.

Actual Results

The fieldset is open for steps 5-7, but then closes after every action attempted in step 8. This makes it difficult for users to:

  • add or select multiple inline entities in the same session (since the fieldset closes every time you click a button in the form after the first item has been added)
  • remove inline entities (since they can easily miss the confirmation message that is rendered but hidden inside the collapsed fieldset)

Comments

GuyPaddock created an issue. See original summary.

dawid_nawrot’s picture

Yep, I can confirm it, the issue is there and using this option as is doesn't make any sense right now.

ocastle’s picture

Status: Active » Needs review
StatusFileSize
new1.67 KB

I think this should fix the issue.

pankaj.singh’s picture

Assigned: Unassigned » pankaj.singh
pankaj.singh’s picture

@ocastle, thanks for the patch. It works on my end. Tested the patch on 8.9.

Inline Entity form featured options now stays open in all the following activities:

  • Click "Edit" next to the item that was added in step 7; OR
  • Click "Remove" next to the item that was added in step 7; OR
  • Click "Add new item"; OR
  • Click "Add an existing item"
joel_osc’s picture

Patch is working for me, thank-you @pankaj.singh!

jproctor’s picture

Status: Needs review » Closed (duplicate)