From df1d52a7efc71d5e9f2ada5bc500f363e7923a40 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Aug 2016 18:19:58 +0530 Subject: [PATCH] Fix positioning of completion popup above widgets --- src/pyj/popups.pyj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyj/popups.pyj b/src/pyj/popups.pyj index af2095e21c..1f78f13cf3 100644 --- a/src/pyj/popups.pyj +++ b/src/pyj/popups.pyj @@ -45,7 +45,9 @@ def create_popup(parent, idprefix): nonlocal popup_count popup_count += 1 pid = (idprefix or 'popup') + '-' + popup_count - div = E.div(id=pid, style='display: none; position: absolute; z-index: {}'.format(POPUP_Z_INDEX)) + # Position has to be fixed so that setting style.top/style.bottom works in + # viewport co-ordinates + div = E.div(id=pid, style='display: none; position: fixed; z-index: {}'.format(POPUP_Z_INDEX)) parent = parent or document.body parent.appendChild(div) return div @@ -166,7 +168,7 @@ class CompletionPopup: cs = c.style cs.left = x + 'px' cs.top = 'auto' if upwards else y + 'px' - cs.bottom = y + 'px' if upwards else 'auto' + cs.bottom = (window.innerHeight - y) + 'px' if upwards else 'auto' cs.width = width + 'px' cs.maxHeight = ((y if upwards else window.innerHeight - y) - 10) + 'px' show_popup(self.container_id, self.associated_widget_ids)