mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-02 22:48:12 +01:00
Comments: Avoid reverting comment reply when context menu is open.
Fix a bug where a comment reply would be discarded if `esc` was pressed to dismiss the context menu in Safari or Firefox. Checks whether the contextmenu is open and ignores the `esc` key if it is. Props yellowafterlife, yogeshbhutkar, joedolson. Fixes #62346. Built from https://develop.svn.wordpress.org/trunk@59514 git-svn-id: http://core.svn.wordpress.org/trunk@58900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
880bce2ad5
commit
cc3c3bf4e6
@ -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();
|
||||
}
|
||||
} )
|
||||
|
2
wp-admin/js/edit-comments.min.js
vendored
2
wp-admin/js/edit-comments.min.js
vendored
File diff suppressed because one or more lines are too long
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59513';
|
||||
$wp_version = '6.8-alpha-59514';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user