diff --git a/src/js/_enqueues/admin/tags-box.js b/src/js/_enqueues/admin/tags-box.js index d47cbed8a5..c4676f263e 100644 --- a/src/js/_enqueues/admin/tags-box.js +++ b/src/js/_enqueues/admin/tags-box.js @@ -369,7 +369,8 @@ /** * Handles pressing enter on the new tag input field. * - * Prevents submitting the post edit form. + * Prevents submitting the post edit form. Uses `keypress` to take + * into account Input Method Editor (IME) converters. * * @since 2.9.0 * @@ -384,11 +385,6 @@ event.preventDefault(); event.stopPropagation(); } - }).keypress( function( event ) { - if ( 13 == event.which ) { - event.preventDefault(); - event.stopPropagation(); - } }).each( function( i, element ) { $( element ).wpTagsSuggest(); }); diff --git a/src/js/_enqueues/admin/tags-suggest.js b/src/js/_enqueues/admin/tags-suggest.js index 238b8584b1..866d7d0603 100644 --- a/src/js/_enqueues/admin/tags-suggest.js +++ b/src/js/_enqueues/admin/tags-suggest.js @@ -107,6 +107,12 @@ window.wp.a11y.speak( window.tagsSuggestL10n.termSelected, 'assertive' ); event.preventDefault(); } else if ( $.ui.keyCode.ENTER === event.keyCode ) { + // If we're in the edit post Tags meta box, add the tag. + if ( window.tagBox ) { + window.tagBox.userAction = 'add'; + window.tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); + } + // Do not close Quick Edit / Bulk Edit event.preventDefault(); event.stopPropagation();