fix(web): context menus no longer scroll when they fit the window (#16776)

This commit is contained in:
Gaya KACI authored and GitHub committed 2026-10-12 01:12:45 +00:00
1 parent 6a99eb3f08
commit 63eaa79242
1 file changed
+4 -2
+4 -2
View File
@@ -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) {