Auto-select first is not selected by data-index

In a custom beforeRender function where I inserts additional dom elements into the autocomplete container and it's first element is not always an autocomplete suggestion item.
The function called 'activate' should be also filtered to data-index attribute.