fix: Cannot access menu on threaded comments, closes #4983

This commit is contained in:
Tom Moor
2023-03-05 16:03:13 -05:00
parent 760355302c
commit 646afec491
2 changed files with 9 additions and 2 deletions

View File

@@ -141,8 +141,14 @@ function usePosition({
// instances leave a margin
const margin = 12;
const left = Math.min(
offsetParent.x + offsetParent.width - menuWidth - margin,
Math.max(offsetParent.x + margin, centerOfSelection - menuWidth / 2)
Math.min(
offsetParent.x + offsetParent.width - menuWidth,
window.innerWidth - margin
),
Math.max(
Math.max(offsetParent.x, margin),
centerOfSelection - menuWidth / 2
)
);
const top = Math.min(
window.innerHeight - menuHeight - margin,