From 662af5062bf89b759a577c6ab5fc7bc9311b680f Mon Sep 17 00:00:00 2001 From: Kultys Jakub Date: Thu, 10 Nov 2016 01:57:56 +0100 Subject: [PATCH] fix(autocomplete): incorrect evaluation of available space in viewport The available space beneath a wrap included space above viewport. When heights of the body and viewport did not match (e.g. on mobile) dropdown was displayed on the wrong side. This change make it so available space is calculated properly. --- src/components/autocomplete/js/autocompleteController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/autocomplete/js/autocompleteController.js b/src/components/autocomplete/js/autocompleteController.js index a7be7da260..ac6ade4218 100644 --- a/src/components/autocomplete/js/autocompleteController.js +++ b/src/components/autocomplete/js/autocompleteController.js @@ -124,7 +124,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, // Automatically determine dropdown placement based on available space in viewport. if (!position) { - position = (top > bot && root.height - hrect.bottom - MENU_PADDING < dropdownHeight) ? 'top' : 'bottom'; + position = (top > bot && root.height - top - MENU_PADDING < dropdownHeight) ? 'top' : 'bottom'; } // Adjust the width to account for the padding provided by `md-input-container` if ($attrs.mdFloatingLabel) {