[wp-trac] [WordPress Trac] #36533: Doesn't work browse media libary on Frontend

WordPress Trac noreply at wordpress.org
Mon Apr 18 21:41:15 UTC 2016


#36533: Doesn't work browse media libary on Frontend
-------------------------------+------------------------------
 Reporter:  purevtsooj         |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:  4.5
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+------------------------------

Comment (by justinbusa):

 I did some more testing and think I have figured out the issue as well as
 a fix.

 I'm not sure why, but in the latest version of jQuery, when this CSS is
 present...

 {{{
 table {
   border-style: solid;
   border-collapse: collapse;
 }
 }}}

 `$el.is(':visible')` will return true, even if the element isn't in the
 DOM.

 This is preventing the media library from being shown because
 `wp.media.open` will return on line `6765` of `wp-includes/js/media-
 views.js` even though `$el` isn't visible because it hasn't been inserted
 into the DOM when `open` is first called...

 {{{
 if ( $el.is(':visible') ) {
         return this;
 }
 }}}

 The solution is to check and see if `$el` is in the document in addition
 to the `$el.is(':visible')` check...

 {{{
 if ( $el.is(':visible') && $.contains( document, $el[ 0 ] ) ) {
         return this;
 }
 }}}

 I have tested and can confirm that this works to solve the issue. Patch to
 follow...

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36533#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list