diff --git a/public/app/core/directives/value_select_dropdown.ts b/public/app/core/directives/value_select_dropdown.ts index 65e0d6137d9..df9911b8728 100644 --- a/public/app/core/directives/value_select_dropdown.ts +++ b/public/app/core/directives/value_select_dropdown.ts @@ -279,7 +279,7 @@ export class ValueSelectDropdownCtrl { } updateUIBoundOptions($scope: IScope, options: any[]) { - this.highlightIndex = -1; + this.highlightIndex = 0; this.search.options = options.slice(0, Math.min(options.length, 1000)); $scope.$apply(); } diff --git a/public/app/core/specs/value_select_dropdown.test.ts b/public/app/core/specs/value_select_dropdown.test.ts index 48c867f5792..2f8f24c017f 100644 --- a/public/app/core/specs/value_select_dropdown.test.ts +++ b/public/app/core/specs/value_select_dropdown.test.ts @@ -253,8 +253,8 @@ describe('updateUIBoundOptions', () => { ctrl.updateUIBoundOptions($scope, options); }); - it('then highlightIndex should be reset', () => { - expect(ctrl.highlightIndex).toEqual(-1); + it('then highlightIndex should be reset to first item', () => { + expect(ctrl.highlightIndex).toEqual(0); }); it('then search.options should be same as options but capped to 1000', () => {