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:32:30 -05:00
parent 302687b11a
commit 0ad97bb4ed

View File

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