diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index e007edf465..9a3d81a751 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -1020,7 +1020,8 @@ window.commentReply = { setTimeout(function() { var rtop, rbottom, scrollTop, vp, scrollBottom, - isComposing = false; + isComposing = false, + isContextMenuOpen = false; rtop = $('#replyrow').offset().top; rbottom = rtop + $('#replyrow').height(); @@ -1035,9 +1036,20 @@ window.commentReply = { $( '#replycontent' ) .trigger( 'focus' ) + .on( 'contextmenu keydown', function ( e ) { + // Check if the context menu is open and set state. + if ( e.type === 'contextmenu' ) { + isContextMenuOpen = true; + } + + // Update the context menu state if the Escape key is pressed. + if ( e.type === 'keydown' && e.which === 27 && isContextMenuOpen ) { + isContextMenuOpen = false; + } + } ) .on( 'keyup', function( e ) { - // Close on Escape except when Input Method Editors (IMEs) are in use. - if ( e.which === 27 && ! isComposing ) { + // Close on Escape unless Input Method Editors (IMEs) are in use or the context menu is open. + if ( e.which === 27 && ! isComposing && ! isContextMenuOpen ) { commentReply.revert(); } } ) diff --git a/wp-admin/js/edit-comments.min.js b/wp-admin/js/edit-comments.min.js index bd4c814936..b96bdb031a 100644 --- a/wp-admin/js/edit-comments.min.js +++ b/wp-admin/js/edit-comments.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -(w=>{var o,s,i=document.title,C=w("#dashboard_right_now").length,c=wp.i18n.__,x=function(t){t=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(t)?0:t},r=function(t,e){var n="";if(!isNaN(e)){if(3<(e=e<1?"0":e.toString()).length){for(;3"),e=i,1<=(a=(a=s.exec(document.title))?(a=a[0],o.html(a),x(o)+t):(o.html(0),t))?(r(o,a),(n=s.exec(document.title))&&(e=document.title.replace(n[0],c("Comments (%s)").replace("%s",o.text())+" "))):(n=s.exec(e))&&(e=e.replace(n[0],c("Comments"))),document.title=e},I=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-pending",o="post-com-count-no-pending",s="comment-count-pending";C||l(n),w("span.pending-count").each(function(){var t=w(this),e=x(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),r(t,e)}),t&&(t=w("span."+s,e),e=w("span."+a,e),t.each(function(){var t=w(this),e=x(t)+n;0===(e=e<1?0:e)?(t.parent().addClass(o),t.removeClass(s).addClass(a)):(t.parent().removeClass(o),t.addClass(s).removeClass(a)),r(t,e)}),e.each(function(){var t=w(this);0