mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Quick/Bulk Edit: Follow up to [49703]. Improve the logic a bit and always return this (the jQuery object) in wpTagsSuggest.
Fixes #51872. git-svn-id: https://develop.svn.wordpress.org/trunk@49710 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
|
||||
// Do not initialize if the element doesn't exist.
|
||||
if ( ! $element.length ) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
@@ -156,14 +156,16 @@
|
||||
$element.autocomplete( options );
|
||||
|
||||
// Ensure the autocomplete instance exists.
|
||||
if ( $element.autocomplete( 'instance' ) ) {
|
||||
$element.autocomplete( 'instance' )._renderItem = function( ul, item ) {
|
||||
return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' )
|
||||
.text( item.name )
|
||||
.appendTo( ul );
|
||||
};
|
||||
if ( ! $element.autocomplete( 'instance' ) ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
$element.autocomplete( 'instance' )._renderItem = function( ul, item ) {
|
||||
return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' )
|
||||
.text( item.name )
|
||||
.appendTo( ul );
|
||||
};
|
||||
|
||||
$element.attr( {
|
||||
'role': 'combobox',
|
||||
'aria-autocomplete': 'list',
|
||||
@@ -178,9 +180,10 @@
|
||||
if ( inputValue ) {
|
||||
$element.autocomplete( 'search' );
|
||||
}
|
||||
} )
|
||||
} );
|
||||
|
||||
// Returns a jQuery object containing the menu element.
|
||||
.autocomplete( 'widget' )
|
||||
$element.autocomplete( 'widget' )
|
||||
.addClass( 'wp-tags-autocomplete' )
|
||||
.attr( 'role', 'listbox' )
|
||||
.removeAttr( 'tabindex' ) // Remove the `tabindex=0` attribute added by jQuery UI.
|
||||
|
||||
Reference in New Issue
Block a user