From 09df948303306da440d794d009622c495afe3c24 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 10 Dec 2016 00:43:34 +0000 Subject: [PATCH] Customize: Prevent scrolling `custom_css` textarea to top when pressing tab. Props tyxla, sstoqnov for testing, celloexpressions for testing. See #38667. Fixes #39134. git-svn-id: https://develop.svn.wordpress.org/trunk@39557 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 65f5584e8a..9f385a003b 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -5300,7 +5300,7 @@ } ); $textarea.on( 'keydown', function onKeydown( event ) { - var selectionStart, selectionEnd, value, scroll, tabKeyCode = 9, escKeyCode = 27; + var selectionStart, selectionEnd, value, tabKeyCode = 9, escKeyCode = 27; if ( escKeyCode === event.keyCode ) { if ( ! $textarea.data( 'next-tab-blurs' ) ) { @@ -5325,10 +5325,8 @@ value = textarea.value; if ( selectionStart >= 0 ) { - scroll = $textarea.scrollTop; textarea.value = value.substring( 0, selectionStart ).concat( '\t', value.substring( selectionEnd ) ); $textarea.selectionStart = textarea.selectionEnd = selectionStart + 1; - textarea.scrollTop = scroll; } event.stopPropagation();