Make WordPress Core

Ticket #38221: 38221.1.diff

File 38221.1.diff, 825 bytes (added by audrasjb, 4 years ago)

Media: Prevent incorrect previous queries to block media search input

  • src/js/_enqueues/admin/media.js

    diff --git a/src/js/_enqueues/admin/media.js b/src/js/_enqueues/admin/media.js
    index 8b603205f6..b66d5e349f 100644
    a b  
    157157                        $mediaGridWrap.trigger( 'wp-media-grid-ready', frame );
    158158                }
    159159
    160                 // Prevents form submission if no post has been selected.
     160                // Prevents form submission if posts exists to be selected and no post has been selected.
    161161                $( '#find-posts-submit' ).click( function( event ) {
    162                         if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
     162                        if ( $( '#find-posts-response input[type="radio"]' ).length && ! $( '#find-posts-response input[type="radio"]:checked' ).length ) {
    163163                                event.preventDefault();
     164                        }
    164165                });
    165166
    166167                // Submits the search query when hitting the enter key in the search input.