diff --git a/src/wp-admin/js/theme-plugin-editor.js b/src/wp-admin/js/theme-plugin-editor.js index 16f9b95b3c..a09eb58753 100644 --- a/src/wp-admin/js/theme-plugin-editor.js +++ b/src/wp-admin/js/theme-plugin-editor.js @@ -376,8 +376,12 @@ wp.themePluginEditor = (function( $ ) { } ); // Scroll the current file into view. - $templateside.find( '.current-file' ).each( function() { - this.scrollIntoView( false ); + $templateside.find( '.current-file:first' ).each( function() { + if ( this.scrollIntoViewIfNeeded ) { + this.scrollIntoViewIfNeeded(); + } else { + this.scrollIntoView( false ); + } } ); };