Customize: Prevent scrolling `custom_css` textarea to top when pressing tab.

Props tyxla, sstoqnov for testing, celloexpressions for testing.
See #38667.
Merges [39557] to the 4.7 branch.
Fixes #39134.

Built from https://develop.svn.wordpress.org/branches/4.7@39569


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-12-12 01:56:33 +00:00
parent 6663e03ced
commit 01aaece3ea
2 changed files with 2 additions and 4 deletions

View File

@ -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();

File diff suppressed because one or more lines are too long