Skip to content

Commit 75879a8

Browse files
author
Tomas Kirda
committed
Merge pull request #251 from freax/auto-select-first-fix
Fix for scroll on autoselect first item
2 parents e6e409f + 3048f48 commit 75879a8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/jquery.autocomplete.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -669,21 +669,21 @@
669669
noSuggestionsContainer.detach();
670670
container.html(html);
671671

672-
// Select first value by default:
673-
if (options.autoSelectFirst) {
674-
that.selectedIndex = 0;
675-
container.children().first().addClass(classSelected);
676-
}
677-
678672
if ($.isFunction(beforeRender)) {
679673
beforeRender.call(that.element, container);
680674
}
681675

682676
that.fixPosition();
683-
684677
container.show();
685-
that.visible = true;
686678

679+
// Select first value by default:
680+
if (options.autoSelectFirst) {
681+
that.selectedIndex = 0;
682+
container.scrollTop(0);
683+
container.children().first().addClass(classSelected);
684+
}
685+
686+
that.visible = true;
687687
that.findBestHint();
688688
},
689689

0 commit comments

Comments
 (0)