TypeScript
fix(web): context menus no longer scroll when they fit the window (#16776)
Gaya KACI63eaa79242cc
diff --git a/apps/web/src/contextMenuFallback.ts b/apps/web/src/contextMenuFallback.tsindex db14ed8c860..1ba2be270ee 100644--- a/apps/web/src/contextMenuFallback.ts+++ b/apps/web/src/contextMenuFallback.ts@@ -303,10 +303,12 @@ export function showContextMenuFallback<T extends string>(menu.dataset.level = String(level);const inner = document.createElement("div");+ // Fit the viewport (minus clampMenuPosition's 4px margins) so menus only+ // scroll when the window is shorter than the menu itself.inner.className =- "max-h-[min(24rem,70vh)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1";+ "max-h-[calc(100vh-0.5rem)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1";inner.style.cssText =- "max-height:min(24rem,70vh);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;";+ "max-height:calc(100vh - 0.5rem);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;";for (const item of entries) {if (item.separatorBefore === true && inner.children.length > 0) {