Closing modal doesn't reset the buttons that launched it, so that if you open up another modal from the wysiwyg, the original modal opens again on top of it.

Modal 1 is a paragraph field using paragraphs classic widget in the open position. The paragraph has a field that allows for media, this is where the entity browser appears using inline entity form complex, to allow creating new or selecting (with the modal) existing media.

Modal 2 is launched from the wysiwyg with an entity embed button of a media entity. If you have previously clicked the close button on Modal 1, Modal 1 appears above Modal 2.

One thing I noticed is that the original state of the buttons that launch Modal 1 aren't resetting when you click the close button (".ui-dialog-titlebar-close").

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

oknate created an issue. See original summary.

oknate’s picture

StatusFileSize
new703 bytes

This patch resets the buttons when clicking the close button.

oknate’s picture

StatusFileSize
new4.25 MB
oknate’s picture

Issue summary: View changes
oknate’s picture

Issue summary: View changes
oknate’s picture

Status: Active » Needs review
recrit’s picture

The patch needs to limit the scope of registered click to the close button of the entity browser modal only.
Currently, it will trigger on any modal dialog close button - see patch snippet below.

$(".ui-dialog-titlebar-close").on('click', function() {
joshua.boltz’s picture

I'm seeing something somewhat similar here, where within the entity browser, if i click to Edit an existing item displayed in the browser, my #states logic triggers the first time as expected. But if i then close out of the modal and try editing another item in the entity browser, my #states does not work.

I tried the patch and it did not help with that issue, but thought it may be related in some way.

edysmp’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for this.
Regarding to #7 I can't see a use case when need to open more the one modal at a time. Also i don't think it is possible.

dave reid’s picture

Version: 8.x-1.3 » 8.x-1.x-dev

Does this need to be re-rolled or applied to 8.x-2.x first?

anybody’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

Yes, I think so @Dave Reid! :)

mikemiles86 made their first commit to this issue’s fork.

mikemiles86’s picture

Merge request created that re-rolls the patch for the 8.x-2.x version.

johan den hollander’s picture

Status: Needs work » Needs review

Marking this as Needs review.
Tested the latest MR which works well to fix the problem with the latest 2.13 release.

recrit’s picture

Status: Needs review » Needs work

The patch and MR need updated to address the issue described in #7

Regarding the comment in #9: You can have more than one dialog open at a time. If have nested entities using the entity browser to edit or select the reference fields on them.