From 893d239a04f53cfe4192a031c28c77bc9be0bda5 Mon Sep 17 00:00:00 2001 From: Bartek Gatz Date: Wed, 25 Nov 2026 14:43:18 +0100 Subject: [PATCH] fix(site/src): keep fixed-height menus within the viewport (#32746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared menu content (`menuClasses.ts`) caps height at `--radix-popper-available-height` and scrolls. Menus that passed their own fixed `max-h-*` replaced that cap, because `cn` (tailwind-merge) lets the caller's class win. When less than the fixed height fit next to the trigger, for example at 200% zoom, those menus ran past the viewport. - **DEQ-640:** the fixed caps become `max-h-[min(,var(--radix-popper-available-height))]`. The `overflow-*` overrides are dropped because the shared class already scrolls. `PRMenuLinks`' `overflow-auto` also re-enabled horizontal scrolling. - **DEQ-641:** the proxy list's inner `max-h-[calc(100vh-22rem)] overflow-y-auto` wrapper is removed. It collapsed to about 100px on short viewports and nested a second scroll region inside the already scrolling menu. The menu is now the only scroll region. Closes DEQ-640 Closes DEQ-641 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-640 | Agent log tabs overflow menu, agent log download menu, Agents PR links menu (top bar and sidebar submenu), Agents "Move to project" submenu | [DEQ-640 screenshots](https://linear.app/codercom/issue/DEQ-640#comment-94f27284) | | DEQ-641 | Navbar Proxy menu | [DEQ-641 screenshots](https://linear.app/codercom/issue/DEQ-641#comment-8b17a825) | Measured in Storybook: - `ChatTopBar/WithManyPRs` at 1280x180: on `main` the menu ends at 235px, 55px past the viewport. On this branch it ends at 180px. - `ProxyMenu/ManyProxiesOpened` at 1200x450: on `main` there is a 98px nested scroller. On this branch there is none and the menu scrolls to the viewport edge. - Arrow-key navigation keeps the focused proxy in view.
Decision log and notes - `MoveToProjectMenuItems.tsx` (`max-h-80 overflow-y-auto` on `SubContent`) has the same root cause and turned up while searching for other callers, so I included it. - No new tests. This is layout only and jsdom can't measure it. Pixel covers `ProxyMenu/ManyProxiesOpened` and `ChatTopBar/WithManyPRs`. Expect a baseline change on `ManyProxiesOpened`: the header and footer items now scroll with the list, and the `scrollbar-thin` styling on the inner list is gone. - axe flags `scrollable-region-focusable` on the scrolling Radix menu container. That happens on `main` too for any menu that scrolls (for example `WithManyPRs`), because Radix menu items use roving `tabindex=-1`. It isn't introduced here. On `main`, the ProxyMenu flag was on the inner wrapper this PR removes. Keyboard access works: arrow keys move focus and scroll the menu. - Reworded the `PRMenuLinks` doc comment to "fits up to five rows", because a short viewport now scrolls sooner. - Self-review: frontend-review, frontend-deep-review, and frontend-accessibility found no blocking or should-fix issues.
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. --- .../modules/dashboard/Navbar/ProxyMenu.tsx | 84 +++++++++---------- site/src/modules/resources/AgentRow.tsx | 2 +- .../DownloadSelectedAgentLogsButton.tsx | 2 +- .../components/MoveToProjectMenuItems.tsx | 2 +- .../AgentsPage/components/PRMenuLinks.tsx | 4 +- 5 files changed, 46 insertions(+), 48 deletions(-) diff --git a/site/src/modules/dashboard/Navbar/ProxyMenu.tsx b/site/src/modules/dashboard/Navbar/ProxyMenu.tsx index 6769afd5177..ea32691c8d9 100644 --- a/site/src/modules/dashboard/Navbar/ProxyMenu.tsx +++ b/site/src/modules/dashboard/Navbar/ProxyMenu.tsx @@ -138,53 +138,51 @@ export const ProxyMenu: React.FC = ({ proxyContextValue }) => { )} {proxyContextValue.proxies && ( -
- - {sortProxiesByLatency(proxyContextValue.proxies, latencies).map( - (proxy) => ( - { - e.preventDefault(); - if (!proxy.healthy) { - toast.error( - `Failed to select proxy "${proxy.display_name}".`, - { - description: - "Please select a healthy workspace proxy.", - }, - ); - closeMenu(); - return; - } - - proxyContextValue.setProxy(proxy); + + {sortProxiesByLatency(proxyContextValue.proxies, latencies).map( + (proxy) => ( + { + e.preventDefault(); + if (!proxy.healthy) { + toast.error( + `Failed to select proxy "${proxy.display_name}".`, + { + description: + "Please select a healthy workspace proxy.", + }, + ); closeMenu(); - }} - > -
-
- -
+ return; + } - {proxy.display_name} - - +
+
+
- - ), - )} - -
+ + {proxy.display_name} + + +
+
+ ), + )} +
)} diff --git a/site/src/modules/resources/AgentRow.tsx b/site/src/modules/resources/AgentRow.tsx index 016b2c274cc..20676b4100c 100644 --- a/site/src/modules/resources/AgentRow.tsx +++ b/site/src/modules/resources/AgentRow.tsx @@ -633,7 +633,7 @@ export const AgentRow: React.FC = ({ = ({ Move to project - + {projectsQuery.isPending && Loading projects…} {projectsQuery.isError && ( diff --git a/site/src/pages/AgentsPage/components/PRMenuLinks.tsx b/site/src/pages/AgentsPage/components/PRMenuLinks.tsx index 486aa392e89..9c7d3443855 100644 --- a/site/src/pages/AgentsPage/components/PRMenuLinks.tsx +++ b/site/src/pages/AgentsPage/components/PRMenuLinks.tsx @@ -6,9 +6,9 @@ import { originRepoLabel } from "../utils/originRepoLabel"; import { prNumber } from "../utils/pullRequest"; import { getPRIconConfig } from "./ChatsSidebar/tree/statusConfig"; -/** Menu content for PR links. The height fits five rows before it scrolls. */ +/** Menu content for PR links. The height fits up to five rows before it scrolls. */ export const prMenuContentClassName = - "max-h-50 w-72 overflow-auto **:[[role=menuitem]]:text-[13px]"; + "max-h-[min(12.5rem,var(--radix-popper-available-height))] w-72 **:[[role=menuitem]]:text-[13px]"; type PRMenuLinksProps = { readonly prStatuses: readonly ChatDiffStatus[];