From fb3e6ea25029c30fb10c849df49d8656ffd3c20c Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 31 Mar 2017 16:34:52 +0000 Subject: [PATCH] Quick/Bulk Edit: Fix the Tag suggestions position on the Bulk Edit textarea. Always passes the complete `position` object to the jQuery autocomplete widget. Also checks if an autocomplete instance already exists on the Bulk Edit textarea. Props davidbenton. Fixes #40242. git-svn-id: https://develop.svn.wordpress.org/trunk@40357 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/inline-edit-post.js | 9 +++++++++ src/wp-admin/js/tags-suggest.js | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/js/inline-edit-post.js b/src/wp-admin/js/inline-edit-post.js index 84ffd788a9..13958a4450 100644 --- a/src/wp-admin/js/inline-edit-post.js +++ b/src/wp-admin/js/inline-edit-post.js @@ -115,6 +115,15 @@ inlineEditPost = { // enable autocomplete for tags if ( 'post' === type ) { $( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) { + /* + * While Quick Edit clones the form each time, Bulk Edit always re-uses + * the same form. Let's check if an autocomplete instance already exists. + */ + if ( $( element ).autocomplete( 'instance' ) ) { + // jQuery equivalent of `continue` within an `each()` loop. + return; + } + $( element ).wpTagsSuggest(); } ); } diff --git a/src/wp-admin/js/tags-suggest.js b/src/wp-admin/js/tags-suggest.js index a678bdc511..6465cc9959 100644 --- a/src/wp-admin/js/tags-suggest.js +++ b/src/wp-admin/js/tags-suggest.js @@ -120,7 +120,9 @@ }, minLength: 2, position: { - my: 'left top+2' + my: 'left top+2', + at: 'left bottom', + collision: 'none' }, messages: { noResults: window.uiAutocompleteL10n.noResults,