diff --git a/src/js/_enqueues/admin/edit-comments.js b/src/js/_enqueues/admin/edit-comments.js index 96ca1f9f48..1d56e7c843 100644 --- a/src/js/_enqueues/admin/edit-comments.js +++ b/src/js/_enqueues/admin/edit-comments.js @@ -1019,7 +1019,8 @@ window.commentReply = { } setTimeout(function() { - var rtop, rbottom, scrollTop, vp, scrollBottom; + var rtop, rbottom, scrollTop, vp, scrollBottom, + isComposing = false; rtop = $('#replyrow').offset().top; rbottom = rtop + $('#replyrow').height(); @@ -1032,10 +1033,17 @@ window.commentReply = { else if ( rtop - 20 < scrollTop ) window.scroll(0, rtop - 35); - $('#replycontent').trigger( 'focus' ).on( 'keyup', function(e){ - if ( e.which == 27 ) - commentReply.revert(); // Close on Escape. - }); + $( '#replycontent' ) + .trigger( 'focus' ) + .on( 'keyup', function( e ) { + // Close on Escape except when Input Method Editors (IMEs) are in use. + if ( e.which === 27 && ! isComposing ) { + commentReply.revert(); + } + } ) + .on( 'compositionstart', function() { + isComposing = true; + } ); }, 600); return false;