Skip to content

Commit d5e6e34

Browse files
committed
fix(web): fit context menus to viewport height
The fallback menu capped its list at min(24rem, 70vh), so the 13-item thread menu scrolled even in tall windows.
1 parent b77108b commit d5e6e34

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/web/src/contextMenuFallback.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,12 @@ export function showContextMenuFallback<T extends string>(
303303
menu.dataset.level = String(level);
304304

305305
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.
306308
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";
308310
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;";
310312

311313
for (const item of entries) {
312314
if (item.separatorBefore === true && inner.children.length > 0) {

0 commit comments

Comments
 (0)