| ... | @@ -303,10 +303,12 @@ export function showContextMenuFallback<T extends string>( | ... | @@ -303,10 +303,12 @@ export function showContextMenuFallback<T extends string>( |
| 303 | menu.dataset.level = String(level); | 303 | menu.dataset.level = String(level); |
| 304 | | 304 | |
| 305 | const inner = document.createElement("div"); | 305 | const inner = document.createElement("div"); |
| | 306 | // Fit the viewport (minus clampMenuPosition's 4px margins) so menus only |
| | 307 | // scroll when the window is shorter than the menu itself. |
| 306 | inner.className = | 308 | inner.className = |
| 307 | "max-h-[min(24rem,70vh)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1"; | 309 | "max-h-[calc(100vh-0.5rem)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1"; |
| 308 | inner.style.cssText = | 310 | inner.style.cssText = |
| 309 | "max-height:min(24rem,70vh);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;"; | 311 | "max-height:calc(100vh - 0.5rem);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;"; |
| 310 | | 312 | |
| 311 | for (const item of entries) { | 313 | for (const item of entries) { |
| 312 | if (item.separatorBefore === true && inner.children.length > 0) { | 314 | if (item.separatorBefore === true && inner.children.length > 0) { |