From e65a667c9c5e9b0215ecd96959d655c6ee1e38a4 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 11 Jun 2016 05:14:18 +0000 Subject: [PATCH] Editor: prevent jumping when using the backspace button in the Text editor in Firefox and IE. Fixes #37072. git-svn-id: https://develop.svn.wordpress.org/trunk@37684 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/editor-expand.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/js/editor-expand.js b/src/wp-admin/js/editor-expand.js index 25f86c2847..bf67c64e04 100644 --- a/src/wp-admin/js/editor-expand.js +++ b/src/wp-admin/js/editor-expand.js @@ -86,17 +86,21 @@ var length = textEditor.value.length; var height = parseInt( textEditor.style.height, 10 ); + var top = window.scrollTop; if ( length < oldTextLength ) { // textEditor.scrollHeight is not adjusted until the next line. textEditor.style.height = 'auto'; - if ( textEditor.scrollHeight >= autoresizeMinHeight ) { + if ( textEditor.scrollHeight > autoresizeMinHeight ) { textEditor.style.height = textEditor.scrollHeight + 'px'; } else { textEditor.style.height = autoresizeMinHeight + 'px'; } + // Prevent scroll-jumping in Firefox and IE. + window.scrollTop = top; + if ( textEditor.scrollHeight < height ) { adjust(); }