[wp-trac] [WordPress Trac] #25618: Fix opening of Media Manager in Customizer

WordPress Trac noreply at wordpress.org
Thu Oct 17 04:40:24 UTC 2013


#25618: Fix opening of Media Manager in Customizer
--------------------------+-----------------------------
 Reporter:  westonruter   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Appearance    |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 If a customizer control does `wp_enqueue_media()` in order to make use of
 the Media Manager, the control also has to do some workarounds to ensure
 that it can be opened properly. Specifically, `wp_enqueue_media()` only
 adds the `wp_print_media_templates` function to the `wp_footer` and
 `admin_footer` actions, leaving out the Customizer which has the closest
 equivalent in `customize_controls_print_footer_scripts`. So a workaround
 is needed, such as:

 {{{#!php
 <?php
 add_action('customize_controls_init', function () {
     add_action( 'wp_enqueue_media', function () {
         add_action(
             'customize_controls_print_footer_scripts',
             'wp_print_media_templates'
         );
     } );
 } );
 }}}

 Furthermore, even though now the Media Manager can be opened, it will
 appear ''behind'' the Customizer: the Customizer has a `z-index` of
 `500000` whereas the `.media-modal` has `z-index:160000` and similarly the
 `.media-modal-backdrop` has `z-index: 159900`. So if the Media Manager is
 to be used in the Customizer, the following CSS overrides aksi have to be
 included:

 {{{#!css
 .media-modal {
         z-index: 660000;
 }
 .media-modal-backdrop {
         z-index: 559900;
 }
 }}}

 These workarounds are not ideal. Preferable, all that a customizer control
 should have to do is call `wp_enqueue_media()`.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25618>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list