From 93bb527725a47d5620aebab5ba6daca99ec42321 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 15 Oct 2017 05:36:10 +0000 Subject: [PATCH] File Editor: Prevent the scrolling of current-file into view to also change initially-focused element in Chrome. Props afercia. Fixes #24048. git-svn-id: https://develop.svn.wordpress.org/trunk@41864 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/theme-plugin-editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 ); + } } ); };