Problem/Motivation

Steps to reproduce:

- Use experimental paragraph widget with a modal window
- Create a container paragraph
- Create a text paragraph inside the container
- Promote container to library
- Edit library item
- Switch to Behavior tabs

The problem is that `switchActiveClass()` function in paragrpahs.admin.js has an if condition is using `content` and `behavior` id:

if ($parWidget.find('#content').hasClass('is-active')) {
  $parWidget.addClass('content-active');
  $parWidget.find('.paragraphs-add-wrapper').parent().removeClass('hidden');
}
else if ($parWidget.find('#behavior').hasClass('is-active')) {
   $parWidget.addClass('behavior-active');
   $parWidget.find('.paragraphs-add-wrapper').parent().addClass('hidden');
}

and in library modal, we could have two elements with content id:

li#content.tabs__tab
ul#content.paragraphs-add-dialog-list.is-active

This will make this if condition unstable.

Comments

pivica created an issue. See original summary.

pivica’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

Here is a patch that is improving if condition. Reformated code and removed extra space indentation.

And i removed next line:

$($parWidget).find($clickedTab.attr('href')).addClass('is-active');

Because this selector is always returning empty.

mbovan’s picture

Status: Needs review » Reviewed & tested by the community

Tested #2 with the described steps to reproduce as well as with Content/Behavior tabs on the main entity form, paragraphs library modal and the main paragraphs library edit form. Works great!

berdir’s picture

Status: Reviewed & tested by the community » Fixed

Overlooked this one, committed.

  • Berdir committed f53819e on 8.x-1.x authored by pivica
    Issue #3114847 by pivica: Unable to switch to behaviors in a modal when...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.