Ticket #51872: 51872.2.diff
File 51872.2.diff, 1.5 KB (added by , 4 years ago) |
---|
-
src/js/_enqueues/admin/tags-suggest.js
40 40 41 41 // Do not initialize if the element doesn't exist. 42 42 if ( ! $element.length ) { 43 return ;43 return this; 44 44 } 45 45 46 46 options = options || {}; … … 156 156 $element.autocomplete( options ); 157 157 158 158 // Ensure the autocomplete instance exists. 159 if ( $element.autocomplete( 'instance' ) ) { 160 $element.autocomplete( 'instance' )._renderItem = function( ul, item ) { 161 return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' ) 162 .text( item.name ) 163 .appendTo( ul ); 164 }; 159 if ( ! $element.autocomplete( 'instance' ) ) { 160 return this; 165 161 } 166 162 163 $element.autocomplete( 'instance' )._renderItem = function( ul, item ) { 164 return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' ) 165 .text( item.name ) 166 .appendTo( ul ); 167 }; 168 167 169 $element.attr( { 168 170 'role': 'combobox', 169 171 'aria-autocomplete': 'list', … … 178 180 if ( inputValue ) { 179 181 $element.autocomplete( 'search' ); 180 182 } 181 } ) 183 } ); 184 182 185 // Returns a jQuery object containing the menu element. 183 .autocomplete( 'widget' )186 $element.autocomplete( 'widget' ) 184 187 .addClass( 'wp-tags-autocomplete' ) 185 188 .attr( 'role', 'listbox' ) 186 189 .removeAttr( 'tabindex' ) // Remove the `tabindex=0` attribute added by jQuery UI.