diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-plugins/js/banner.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-plugins/js/banner.js index 5c1f5f3c42db0..eab3a178f6e15 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-plugins/js/banner.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-plugins/js/banner.js @@ -25,3 +25,15 @@ document.addEventListener( 'DOMContentLoaded', () => { ` ); } ); + +const wpcomPluginObserver = new MutationObserver( () => { + if ( + ! document.querySelector( '.plugin-install-search .current' ) || + document.querySelector( '.no-plugin-results' ) + ) { + document.querySelector( '.wpcom-plugins-banner' ).classList.remove( 'hidden' ); + } else { + document.querySelector( '.wpcom-plugins-banner' ).classList.add( 'hidden' ); + } +} ); +wpcomPluginObserver.observe( document.getElementById( 'plugin-filter' ), { childList: true } );