fix: context menu flips upward when near viewport bottom

- If click.y + 260 > window.innerHeight: position bottom instead of top
- Also clamp left to prevent right-edge overflow
- Menu now appears above the click point when there's no room below
This commit is contained in:
2026-07-27 07:46:06 +07:00
parent 993610ca37
commit f98ade5d58
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -16586,8 +16586,9 @@ const App = () => {
})), " Ctrl+Scroll: Playhead"))), contextMenu && (contextMenu.isSubTab ? /*#__PURE__*/React.createElement("div", {
className: "fixed z-[60] bg-[#2a2a2a] border border-zinc-700 rounded-lg shadow-2xl py-1 w-64 overflow-y-auto",
style: {
left: contextMenu.x,
top: Math.min(contextMenu.y, window.innerHeight - 200),
left: Math.min(contextMenu.x, window.innerWidth - 260),
top: contextMenu.y + 200 > window.innerHeight ? undefined : contextMenu.y,
bottom: contextMenu.y + 200 > window.innerHeight ? (window.innerHeight - contextMenu.y) : undefined,
maxHeight: '60vh'
},
onClick: e => e.stopPropagation()
@@ -16675,8 +16676,9 @@ const App = () => {
}, "Ctrl+L"))) : /*#__PURE__*/React.createElement("div", {
className: "fixed z-[60] bg-[#2a2a2a] border border-zinc-700 rounded-lg shadow-2xl py-1 w-64 overflow-y-auto",
style: {
left: contextMenu.x,
top: Math.min(contextMenu.y, window.innerHeight - 200),
left: Math.min(contextMenu.x, window.innerWidth - 260),
top: contextMenu.y + 260 > window.innerHeight ? undefined : contextMenu.y,
bottom: contextMenu.y + 260 > window.innerHeight ? (window.innerHeight - contextMenu.y) : undefined,
maxHeight: '60vh'
},
onClick: e => e.stopPropagation()
File diff suppressed because one or more lines are too long