Skip to content

Commit

Permalink
Fix dropdown going off top of screen
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
askvortsov1 committed Mar 2, 2021
1 parent 2ef0391 commit e39c798
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/src/forum/addComposerAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e39c798

Please sign in to comment.