From 3d54802a3057a6db878d9d9fbb0903e99e444151 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Tue, 4 Aug 2015 18:00:22 +0100 Subject: [PATCH] Fix baseline when direction-up positioning is used https://github.com/angular-ui/ui-select/issues/973 --- src/common.css | 12 ++++++++++++ src/uiSelectDirective.js | 4 ---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/common.css b/src/common.css index e1026d4a1..775e5c580 100644 --- a/src/common.css +++ b/src/common.css @@ -47,6 +47,10 @@ body > .select2-container.open { border-top-right-radius: 0; } .ui-select-container[theme="select2"].direction-up .ui-select-dropdown { + bottom: 100%; + top: auto; + position: absolute; + border-radius: 4px; /* FIXME hardcoded value :-/ */ border-bottom-left-radius: 0; border-bottom-right-radius: 0; @@ -89,6 +93,10 @@ body > .select2-container.open { /* Handle up direction Selectize */ .ui-select-container[theme="selectize"].direction-up .ui-select-dropdown { + bottom: 100%; + top: auto; + position: absolute; + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); margin-top: -2px; /* FIXME hardcoded value :-/ */ @@ -250,5 +258,9 @@ body > .ui-select-bootstrap.open { /* Handle up direction Bootstrap */ .ui-select-container[theme="bootstrap"].direction-up .ui-select-dropdown { + bottom: 100%; + top: auto; + position: absolute; + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); } diff --git a/src/uiSelectDirective.js b/src/uiSelectDirective.js index 3d391825c..39adb5e00 100644 --- a/src/uiSelectDirective.js +++ b/src/uiSelectDirective.js @@ -274,8 +274,6 @@ uis.directive('uiSelect', // Determine if the direction of the dropdown needs to be changed. if (offset.top + offset.height + offsetDropdown.height > $document[0].documentElement.scrollTop + $document[0].documentElement.clientHeight) { - dropdown[0].style.position = 'absolute'; - dropdown[0].style.top = (offsetDropdown.height * -1) + 'px'; element.addClass(directionUpClassName); } @@ -288,8 +286,6 @@ uis.directive('uiSelect', } // Reset the position of the dropdown. - dropdown[0].style.position = ''; - dropdown[0].style.top = ''; element.removeClass(directionUpClassName); } });