From 2e9c184b3b3bfc8e3f69232324cd9cee02f6cecd Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 23 Jul 2018 14:27:21 +0200 Subject: [PATCH] Fix positioning of mention dropdown Previously, the positioning logic did not account for the case when the textarea was already scrolled down a bit, thus often rendering the dropdown off-screen. Fixes flarum/core#1021. --- extensions/mentions/js/src/forum/addComposerAutocomplete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/mentions/js/src/forum/addComposerAutocomplete.js b/extensions/mentions/js/src/forum/addComposerAutocomplete.js index 1f43bdef9..c0d63ec04 100644 --- a/extensions/mentions/js/src/forum/addComposerAutocomplete.js +++ b/extensions/mentions/js/src/forum/addComposerAutocomplete.js @@ -153,9 +153,9 @@ export default function addComposerAutocomplete() { const height = dropdown.$().outerHeight(); const parent = dropdown.$().offsetParent(); let left = coordinates.left; - let top = coordinates.top + 15; + let top = coordinates.top - this.scrollTop + 15; if (top + height > parent.height()) { - top = coordinates.top - height - 15; + top = coordinates.top - this.scrollTop - height - 15; } if (left + width > parent.width()) { left = parent.width() - width;