From 7716dae9face743cc0d4b3ff34d91ca14c6086a6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 3 Sep 2014 09:37:01 +0000 Subject: [PATCH] Editor scrolling: Avoid jumping to the cursor when modifier and scrolling keys are pressed. fixes #29485. git-svn-id: https://develop.svn.wordpress.org/trunk@29692 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/editor-expand.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wp-admin/js/editor-expand.js b/src/wp-admin/js/editor-expand.js index 1fa72828b5..260ee25513 100644 --- a/src/wp-admin/js/editor-expand.js +++ b/src/wp-admin/js/editor-expand.js @@ -195,6 +195,14 @@ jQuery( document ).ready( function($) { return; } + // Bail on special keys. + if ( key <= 47 && ! ( key === VK.SPACEBAR || key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE || key === VK.UP || key === VK.LEFT || key === VK.DOWN || key === VK.UP ) ) { + return; + // OS keys, function keys, num lock, scroll lock + } else if ( ( key >= 91 && key <= 93 ) || ( key >= 112 && key <= 123 ) || key === 144 || key === 145 ) { + return; + } + cursorTop = offset.top + editor.iframeElement.getBoundingClientRect().top; cursorBottom = cursorTop + offset.height; cursorTop = cursorTop - buffer;