function adjustScroll(isDownKey) {
				var listId = 'option-list';
				var listItemId = 'option-list-item-' + $ctrl.keyboardFocusIndex;

				// Gets the "next" list item based on whether the down key or up key was pressed.
				var nextListItemDirection = isDownKey ? 1 : -1;
				var nextListItemId = 'option-list-item-' + ($ctrl.keyboardFocusIndex + nextListItemDirection);

				var list = $document[0].getElementById(listId);
				var listItem = $document[0].getElementById(listItemId);
				var nextListItem = $document[0].getElementById(nextListItemId) || listItem;

				// adjusts scroll value when the nextListItem is ~below~ the viewable window.
				if (nextListItem.offsetTop >= list.offsetHeight + list.scrollTop) {
					list.scrollTop = nextListItem.offsetTop - list.offsetHeight + nextListItem.offsetHeight;
				}

				// adjusts scroll value when the nextListItem is ~above~ the viewable window.
				if (list.scrollTop > nextListItem.offsetTop) {
					list.scrollTop = nextListItem.offsetTop;
				}
			}
// Adjusts the scroll value of the list based on which listItem is currently focused.
Adjusts the scroll value of the list based on which listItem is currently focused.
Adjusts the scroll value of the list based on which listItem is currently focused .
function adjustScroll(isDownKey) {
				var listId = 'option-list';
				var listItemId = 'option-list-item-' + $ctrl.keyboardFocusIndex;
				var nextListItemDirection = isDownKey ? 1 : -1;
				var nextListItemId = 'option-list-item-' + ($ctrl.keyboardFocusIndex + nextListItemDirection);
				var list = $document[0].getElementById(listId);
				var listItem = $document[0].getElementById(listItemId);
				var nextListItem = $document[0].getElementById(nextListItemId) || listItem;
				if (nextListItem.offsetTop >= list.offsetHeight + list.scrollTop) {
					list.scrollTop = nextListItem.offsetTop - list.offsetHeight + nextListItem.offsetHeight;
				}
				if (list.scrollTop > nextListItem.offsetTop) {
					list.scrollTop = nextListItem.offsetTop;
				}
			}
function adjustScroll ( isDownKey ) { var listId = 'option-list' ; var listItemId = 'option-list-item-' + $ctrl . keyboardFocusIndex ; var nextListItemDirection = isDownKey ? 1 : - 1 ; var nextListItemId = 'option-list-item-' + ( $ctrl . keyboardFocusIndex + nextListItemDirection ) ; var list = $document [ 0 ] . getElementById ( listId ) ; var listItem = $document [ 0 ] . getElementById ( listItemId ) ; var nextListItem = $document [ 0 ] . getElementById ( nextListItemId ) || listItem ; if ( nextListItem . offsetTop >= list . offsetHeight + list . scrollTop ) { list . scrollTop = nextListItem . offsetTop - list . offsetHeight + nextListItem . offsetHeight ; } if ( list . scrollTop > nextListItem . offsetTop ) { list . scrollTop = nextListItem . offsetTop ; } }
Adjusts the scroll value of the list based on which listItem is currently focused.
Adjusts the scroll value of the list based on which listItem is currently focused .
// Gets the "next" list item based on whether the down key or up key was pressed. // adjusts scroll value when the nextListItem is ~below~ the viewable window. // adjusts scroll value when the nextListItem is ~above~ the viewable window.