If you are using jQuery Update to get a newer version of jQuery UI on your site (1.10) and then try to open up the media browser from within a Ctools modal dialog (for example, the Panels In-Place-Editor) the media dialog will appear underneath the Ctools module so you can't see it.

Here are some references:
http://jqueryui.com/upgrade-guide/1.10/#removed-zindex-option
http://stackoverflow.com/questions/14954104/why-jquery-ui-1-10-remove-jq...

Whatever behavior used to work to make the media dialog get its z-index automatically set to be the highest index on the page no longer seems to be working for me, so it winds up underneath the Ctools modal dialog.

There's probably a real fix that involves getting the "stacking" referred to in those links working correctly again, but a quick fix is to set the z-index in CSS.

Comments

David_Rothstein’s picture

Status: Active » Needs review
StatusFileSize
new271 bytes

Here's a patch. Haven't tested this anywhere else though (e.g. with older versions of jQuery UI).

saltednut’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Yeah, this is a bit of of a showstopper once you update to jquery_update 2.4 or higher so I'm marking it major.

I can confirm the patch is a working fix.

Thanks @David_Rothstein!

  • aaron committed 4494ac6 on 7.x-2.x
    Issue #2272567 by David_Rothstein: Media dialog appears underneath the...
aaron’s picture

Status: Reviewed & tested by the community » Fixed
func0der’s picture

Status: Fixed » Needs work

This is not a good fix. Sorry, but that is not stackable. It would fix the current problem with ctools and media, but not if there are dialogs in dialogs in dialogs or something like that.

We need a more generic fix, please.

jQuery UI changelog entry to this topic: http://jqueryui.com/upgrade-guide/1.10/#removed-zindex-option

MantasK’s picture

I have same issue. I wrote my solution here: #2384543: Popup goes below ctools modal
of course it is not good fix also, but for me works better that putting manual z-index value as it creates problems in other cases

ptsimard’s picture

This commit broke Media browser on our instances because the z-index is putting the overlay on top of everything preventing interaction with the media browser. As soon as I disable that z-index : 10001 !important; it works again.

I suggest reverting this commit.

sylus’s picture

StatusFileSize
new271 bytes

Just attaching a patch for drush make purposes that reverts this commit and works on 2.0-alpha4.

func0der’s picture

Check out the new alpha4. That should solve this problem.

Apply this patch here additionally https://www.drupal.org/node/2316707 and everything should be working fine.

elijah lynn’s picture

albert volkman’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new297 bytes

I'm experiencing this issue currently in the 1.x branch, so posting the CSS hacky backport here.

albert volkman’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Moving this back 2.x since it hasn't been fully fixed there yet.

func0der’s picture

Have you tried what I have mentioned in #9?

albert volkman’s picture

The 1.x branch doesn't have an alpha4, just 2.x. We haven't upgraded to 2.x because the project page clearly states that 1.x is recommended for production.

func0der’s picture

We are talking about a 2.x bug here. Not 1.x.
My question was: Is it fixed for the 2.x branch and my instructions from #9?

dave reid’s picture

I'm confused, does reverting the original fix actually resolve the issue as well? Or do we still have a bug that would need to be fixed?

func0der’s picture

As I have said before: the here suggested patches is only A solution, but neither a good one nor the best.

By "suggested patches" I mean all the patches that are uploaded in this issue.

There should NOT be a bug anymore after doing what I have said in #9

dave reid’s picture

It doesn't seem to me that the original fix that was committed in 7.x-2.x addressed the concern with using Overlay in https://www.drupal.org/node/2272567#comment-9566535. So right now this is currently considering rolling back the original fix.

func0der’s picture

Oh, yeah. You are right.

I didn't not recognize that the "fix" has actually been committed.

jakeschlachter’s picture

Status: Needs review » Active
Related issues: +#2541816: Issue between recent media module update and CiviCRM UI

Unfortunately, the fix entirely breaks the CiviCRM UI, which is also defining the .ui-front selector. As a result of the !important property, all CiviCRM dialog modals are now greyed out and inaccessible, due to being "under" the active z-index. (You can see the window, but are unable to click any buttons.)

Some of us first noticed this using Open Atrium and CiviCRM. The recent 2.43 release of OA pulls in this fix and breaks CiviCRM. I'll file a bug with CiviCRM, too. In the meantime, users of both CiviCRM and the media module will likely need to remove this fix in the media/css/media.css file.

jakeschlachter’s picture

From the CiviCRM team, (related issue CRM-16935) looks like this might need to be fixed in media.

CiviCRM does not set the z-index of its dialogs at all. We include the latest version of jQuery UI and use it as-is.
Perhaps [the media team] had good reasons for doing it, but hacking with jQuery UI's css is going to break not only CiviCRM but any other module or theme that uses jQuery UI.

I am wary of playing "arms race" with the media module and trying to make hacks that are even more !important than theirs. jQuery UI's ui-front is a well thought-out but delicately balanced system, and knocking out one pillar from under it seems likely to set off a chain of events that will not end well.

devin carlson’s picture

Status: Active » Fixed

I verified that this is no longer necessary now that #2316707: Drupal.settings.media values become an array of when multiple fields are used is fixed. I manually testing adding media inside of a ctools modal and with the Panels IPE and didn't run into any problems.

Reverted.

  • Devin Carlson committed 7de4580 on 7.x-2.x
    Revert "Issue #2272567 by David_Rothstein: Media dialog appears...

Status: Fixed » Closed (fixed)

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

func0der’s picture

Finally! Nice!

thank you, Devin.

ravibarnwal’s picture

Status: Closed (fixed) » Active

I am using media field on form api, panels, panopoly it is still showing media dialog underneath the Ctools modal dialog. I have tested with beta 2 version and dev version both are resulting same. So I need to apply same css again whatever reverted in https://www.drupal.org/node/2272567#comment-10183652.

mlanth’s picture

As #27 states, I can also confirm this is still an issue. I have a media field in a ctools content type edit form which has the dialog appearing underneath the ctools modal.

I am pretty sure this issue is because when a media field is added within an ajax generated form, it doesn't apply the media style settings which are supposed to be added.

caschbre’s picture

I too am having the same issue even with the patch applied from #2316707: Drupal.settings.media values become an array of when multiple fields are used.

fuzzy76’s picture

Status: Active » Reviewed & tested by the community

Yes, this bug is back. Re-commit the fix? A bit unsure what status is correct for this issue now.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

Could probably add it back but with a more specific selector targeting it to the media dialog only (e.g. .ui-front.media-wrapper rather than just .ui-front)?

I wrote the original patch over two years ago, so I don't really remember if there was a specific reason I didn't do that at the time. Probably not - I probably just saw that some of the other CSS rules in that file aren't media-specific and decided to do the same with mine, without thinking about it much...

Changing the selector to be media-specific seems like it would at least prevent #21. (Not sure about #7 since it's not clear to me which "overlay" that refers to.)

fuzzy76’s picture

StatusFileSize
new279 bytes

- more specific selector as per #31
- rerolled against head
- tested ok on 7.x-2.0-beta2

I also took the liberty to hide patches from #1 and #8 since this should replace them.

steve hanson’s picture

I can confirm that #32 fixes the horrible interaction with CiviCRM alluded to in #21 -

phily’s picture

StatusFileSize
new674 bytes

I'm facing the same problem fixed by using patch in comment #32 but when using Wysiwyg + CKEditor in maximized mode, the media popup close button is badly displayed.
So, here is a new patch which includes #32 and fixes close button.

The last submitted patch, 8: media_dialog_appears-2272567-8.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 34: media_dialog_appears_2272567-34.patch, failed testing.

joseph.olstad’s picture

+needs reroll

temkin’s picture

Status: Needs work » Needs review

@PhilY, thanks for a new patch, but it's better to open a new issue for a close button and submit a patch there, rather than mixing it all together here. Besides, your patch has a reference to adminimal theme that not everyone will have. Therefore I'm hiding it.

As for re-roll, I don't think it's needed. Patch from #32 still applies cleanly to the latest head. I'm marking this as "Needs review", although we had a couple of confirmation that #32 fixes the problem - potential candidate for "RTBC".

cboyden’s picture

StatusFileSize
new318.08 KB

The patch in #32 works for having media fields in CTools modals, but depending on the theme in use it could be ugly. Unfortunately it's the thing that fixes #21 that makes it ugly: the media dialog is at the top of the stack, but its background overlay is underneath the CTools modal. See this screenshot showing Media 2.0-beta13 plus the patch in use on the latest Panopoly:
Screenshot showing media dialog directly on top of CTools dialog with no overlay between them.

This is going to be a problem anywhere there are modal dialogs - or any kind of thing with a z-index - being added by something other than jQuery UI. For example navbar gives its toolbar a z-index of 1002, and admin menu has a z-index of 999.

It might be better to bump up the default z-index for jQuery UI dialogs in .ui-front, and at the same time bump down the z-index for CTools dialogs. If they are all set to the same number, the source code order of the elements will determine the stacking. This will do the right thing in this case because media dialogs are appended after CTools dialogs when you press the Browse button.

CTools sets its z-indexes to 1000 (background overlay) and 1001 (dialog) in the style attribute of the element, which means they can't be overridden by any CSS rules based on selectors. Maybe this needs to be fixed in CTools instead of here.

cboyden’s picture

There is a long-standing issue in CTools to switch to using the jQuery UI modal, see #1397370: Make modal.js use jQuery dialog.

joseph.olstad’s picture

@cboyden , so the related ctools patch works for you in this case?

cboyden’s picture

@joseph.olstad, in my quick test the CTools patch works with a few adjustments. The patch doesn't remove the z-index from the style attribute of the modal div elements, nor does it add the ui-front class. Once I did that, it worked fine. jQuery UI handles the stacking. The only problem was, the CTools modal was positioned in such a way that it was underneath the admin menu provided by navbar. Positioning could be adjusted to fix that, it just needs to be ~20px further down, and be fixed instead of scrolling with the viewport. I'm working on an updated patch.

joseph.olstad’s picture

@cboyden , looking forward to seeing your patch.

Thanks!

steinmb’s picture

Status: Needs review » Needs work

  • aaron committed 4494ac6 on 7.x-3.x
    Issue #2272567 by David_Rothstein: Media dialog appears underneath the...
  • Devin Carlson committed 7de4580 on 7.x-3.x
    Revert "Issue #2272567 by David_Rothstein: Media dialog appears...
khaldoon_masud’s picture

Adding the following style to media/css/media.css works for me:

.ui-front {
z-index: 10001 !important;
}

Ctools module setting the dialog z-index to 1000.
jquery ui 1.10 in jquery_update module is setting media dialog z-index to 100.
media module 7.x-2.8 is not setting any z-index.

So we can either ajust the ctools and jquery ui z-index, or add z-index in the media.css file.

joseph.olstad’s picture

Patch 32 should be committed as-is afaik

joseph.olstad’s picture

Ah re-read this thread, seems we were waiting on the ctools related issue mentioned above.

It would be nice if we could get some reviews for the ctools issue and rtbc the ctools related issue if possible get that in

Anonymous’s picture

I can confirm #46 worked for me THANK YOU!!!!!

joseph.olstad’s picture

Status: Needs work » Needs review

review #46

  • joseph.olstad committed 8796a78 on 7.x-2.x authored by PhilY
    Issue #2272567 by Albert Volkman, David_Rothstein, fuzzy76, sylus, PhilY...

  • joseph.olstad committed 8796a78 on 7.x-3.x authored by PhilY
    Issue #2272567 by Albert Volkman, David_Rothstein, fuzzy76, sylus, PhilY...
joseph.olstad’s picture

Status: Needs review » Fixed

actually I should have creditted @khaldoon_masud for #46

David_Rothstein’s picture

Status: Fixed » Needs work

Hold on, isn't that the exact same patch that I wrote originally for this issue, which got committed in September 2014 but then had to be reverted because it broke things? Doesn't it still cause the same problems?

David_Rothstein’s picture

Status: Needs work » Needs review
StatusFileSize
new366 bytes

#32 still seems like it's probably the best fix, although #39 suggests it's not a complete fix. Here's a quick patch (untested) to switch to the approach from #32.

However, if people aren't sure that's correct, then probably the above commit should just be reverted instead, and start from scratch again.

joseph.olstad’s picture

Status: Needs review » Fixed

joseph.olstad’s picture

yes more specific targetting is safer thanks again!
should be good now.

Status: Fixed » Closed (fixed)

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