Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 9f198c9

Browse files
Azahemmalerba
authored andcommitted
fix(autocomplete): incorrect evaluation of available space in viewport (#9999)
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.
1 parent 88e0c8f commit 9f198c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/autocomplete/js/autocompleteController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
125125

126126
// Automatically determine dropdown placement based on available space in viewport.
127127
if (!position) {
128-
position = (top > bot && root.height - hrect.bottom - MENU_PADDING < dropdownHeight) ? 'top' : 'bottom';
128+
position = (top > bot && root.height - top - MENU_PADDING < dropdownHeight) ? 'top' : 'bottom';
129129
}
130130
// Adjust the width to account for the padding provided by `md-input-container`
131131
if ($attrs.mdFloatingLabel) {

0 commit comments

Comments
 (0)