From 0ad97bb4edbdd53f1d445badda4b1f5921a56b9e Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Mon, 1 Mar 2021 23:32:30 -0500 Subject: [PATCH] Fix dropdown going off top of screen The previous solution didn't properly account for document scroll, so when replying to posts, the parent offset would be extremely large, and it'd fall back to the top coordinate, which is out of bounds on small screens. --- extensions/mentions/js/src/forum/addComposerAutocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/mentions/js/src/forum/addComposerAutocomplete.js b/extensions/mentions/js/src/forum/addComposerAutocomplete.js index 53c32d95b..27f4b6db0 100644 --- a/extensions/mentions/js/src/forum/addComposerAutocomplete.js +++ b/extensions/mentions/js/src/forum/addComposerAutocomplete.js @@ -172,7 +172,7 @@ export default function addComposerAutocomplete() { } // Prevent the dropdown from going off screen on mobile - top = Math.max(-parent.offset().top, top); + top = Math.max(-(parent.offset().top - $(document).scrollTop()), top); left = Math.max(-parent.offset().left, left); dropdown.show(left, top);