From edceffdaaf16011152737bdf0e80eee166d4a8f3 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 3 May 2016 17:01:45 +0100 Subject: [PATCH] Ensure typedInput dropdown doesn't fall off the page --- editor/js/ui/typedInput.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/js/ui/typedInput.js b/editor/js/ui/typedInput.js index 720cc80e0..a02a39998 100644 --- a/editor/js/ui/typedInput.js +++ b/editor/js/ui/typedInput.js @@ -1,5 +1,5 @@ /** - * Copyright 2015 IBM Corp. + * Copyright 2015, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,8 +161,13 @@ var that = this; var pos = relativeTo.offset(); var height = relativeTo.height(); + var menuHeight = menu.height(); + var top = (height+pos.top-3); + if (top+menuHeight > $(window).height()) { + top -= (top+menuHeight)-$(window).height()+5; + } menu.css({ - top: (height+pos.top-3)+"px", + top: top+"px", left: (2+pos.left)+"px", }); menu.slideDown(100);