Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(autocomplete): improves logic behind scrolling items into view on…
Browse files Browse the repository at this point in the history
… keyboard navigation

Closes #2615
  • Loading branch information
Robert Messerle committed May 1, 2015
1 parent 8584692 commit 211a31e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/autocomplete/js/autocompleteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $timeout, $
wrap: $element.find('md-autocomplete-wrap')[0],
root: document.body
};
elements.li = elements.ul.getElementsByTagName('li');
elements.snap = getSnapTarget();
elements.$ = getAngularElements(elements);
}
Expand Down Expand Up @@ -348,8 +349,9 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $timeout, $
}

function updateScroll () {
var top = ITEM_HEIGHT * self.index,
bot = top + ITEM_HEIGHT,
var li = elements.li[self.index],
top = li.offsetTop,
bot = top + li.offsetHeight,
hgt = elements.ul.clientHeight;
if (top < elements.ul.scrollTop) {
elements.ul.scrollTop = top;
Expand Down

0 comments on commit 211a31e

Please sign in to comment.