From 40a0f2e0c91dba6ebad2f1043b40e7b2081470b9 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Mon, 1 Mar 2021 23:34:47 -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/emoji/js/src/forum/addComposerAutocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/emoji/js/src/forum/addComposerAutocomplete.js b/extensions/emoji/js/src/forum/addComposerAutocomplete.js index a6a1bf1d8..9cba1af64 100644 --- a/extensions/emoji/js/src/forum/addComposerAutocomplete.js +++ b/extensions/emoji/js/src/forum/addComposerAutocomplete.js @@ -148,7 +148,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);