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.
This commit is contained in:
Alexander Skvortsov 2021-03-01 23:34:47 -05:00
parent e83b88d17d
commit 40a0f2e0c9

View File

@ -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);