From 63fa943a52d441f7eec4222b6c1eac0362908024 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Fri, 21 Dec 2012 00:53:23 +0100
Subject: [PATCH] multiSelect: Don't force popup above if there's no room for
 it there.

---
 core/js/multiselect.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/js/multiselect.js b/core/js/multiselect.js
index 9e808a2bb7..d66c8eba62 100644
--- a/core/js/multiselect.js
+++ b/core/js/multiselect.js
@@ -238,7 +238,9 @@
 				list.append(li);
 			}
 			var pos=button.position();
-			if($(document).height() > button.offset().top+button.outerHeight() + list.children().length * button.height()) {
+			if($(document).height() > (button.offset().top+button.outerHeight() + list.children().length * button.height())
+				|| $(document).height()/2 > pos.top
+			) {
 				list.css('top',pos.top+button.outerHeight()-5);
 				list.css('left',pos.left+3);
 				list.css('width',(button.outerWidth()-2)+'px');
-- 
GitLab