1 | | Hi, was wondering if someone could help me out with where to modify this code exactly as I'm not a programmer by default, looking at @justinbusa commentI did some more testing and think I have figured out the issue as well as a fix. |
2 | | I'm not sure why, but in the latest version of jQuery, when this CSS is present... |
3 | | table { |
4 | | border-style: solid; |
5 | | border-collapse: collapse; |
6 | | } |
7 | | $el.is(':visible') will return true, even if the element isn't in the DOM. |
8 | | 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... |
9 | | if ( $el.is(':visible') ) { |
10 | | return this; |
11 | | } |
12 | | The solution is to check and see if $el is in the document in addition to the $el.is(':visible') check... |
13 | | if ( $el.is(':visible') && $.contains( document, $el[ 0 ] ) ) { |
14 | | return this; |
15 | | } |
16 | | I have tested and can confirm that this works to solve the issue. Patch to follow... |
| 1 | Hi, was wondering if someone could help me out with where to modify this code exactly as I'm not a programmer by default, looking at @justinbusa comment |
| 2 | |
| 3 | > I did some more testing and think I have figured out the issue as well as a fix. |
| 4 | > |
| 5 | > I'm not sure why, but in the latest version of jQuery, when this CSS is present... |
| 6 | > |
| 7 | > {{{ |
| 8 | > table { |
| 9 | > border-style: solid; |
| 10 | > border-collapse: collapse; |
| 11 | > } |
| 12 | > }}} |
| 13 | > |
| 14 | > `$el.is(':visible')` will return true, even if the element isn't in the DOM. |
| 15 | > |
| 16 | > 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... |
| 17 | > |
| 18 | > {{{ |
| 19 | > if ( $el.is(':visible') ) { |
| 20 | > return this; |
| 21 | > } |
| 22 | > }}} |
| 23 | > |
| 24 | > The solution is to check and see if `$el` is in the document in addition to the `$el.is(':visible')` check... |
| 25 | > |
| 26 | > {{{ |
| 27 | > if ( $el.is(':visible') && $.contains( document, $el[ 0 ] ) ) { |
| 28 | > return this; |
| 29 | > } |
| 30 | > }}} |
| 31 | > |
| 32 | > I have tested and can confirm that this works to solve the issue. Patch to follow... |
| 33 | |