Skip to content

Commit 5357208

Browse files
fix(web): keep profile names from stretching the menus
Profile names are user-supplied and run to 48 characters. The Browser sub-menu rendered them bare inside an unbounded popup, so a long one widened it to fit-content and wrapped; it is now capped and truncated like the other name-bearing menus. The clear actions repeated the name their own group heading already shows, which drove the popup far past its width for no added information. The heading keeps the profile and the actions keep fixed-length labels. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 3b8de1a commit 5357208

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

apps/web/src/components/RightPanelTabs.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,13 +732,18 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
732732
<Globe2 />
733733
Browser
734734
</MenuSubTrigger>
735-
<MenuSubPopup className="min-w-40">
735+
{/*
736+
Capped and truncated: profile names are user-supplied
737+
and run to 48 characters, which would otherwise widen
738+
the popup to fit-content and wrap.
739+
*/}
740+
<MenuSubPopup className="min-w-40 max-w-56">
736741
{browserProfiles.map((profile) => (
737742
<MenuItem
738743
key={profile.id}
739744
onClick={() => props.onAddBrowserInProfile(profile.id)}
740745
>
741-
{profile.name}
746+
<span className="min-w-0 truncate">{profile.name}</span>
742747
</MenuItem>
743748
))}
744749
</MenuSubPopup>

apps/web/src/components/preview/PreviewMoreMenu.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,27 @@ export function PreviewMoreMenu({
200200
at open and nothing else in the chrome shows it.
201201
*/}
202202
<MenuGroup>
203-
{profileName ? <MenuGroupLabel>Profile: {profileName}</MenuGroupLabel> : null}
203+
{/*
204+
The heading carries the profile so the actions below can keep
205+
fixed-length labels: repeating a name of up to 48 characters in
206+
each one drove the popup far past its width.
207+
*/}
208+
{profileName ? (
209+
<MenuGroupLabel>
210+
<span className="min-w-0 truncate">Profile: {profileName}</span>
211+
</MenuGroupLabel>
212+
) : null}
204213
<MenuItem
205214
onClick={() =>
206215
void bridge.clearCookies(environmentId, profileId).catch(() => undefined)
207216
}
208217
>
209-
{profileName ? `Clear cookies (${profileName})` : "Clear cookies"}
218+
Clear cookies
210219
</MenuItem>
211220
<MenuItem
212221
onClick={() => void bridge.clearCache(environmentId, profileId).catch(() => undefined)}
213222
>
214-
{profileName ? `Clear cache (${profileName})` : "Clear cache"}
223+
Clear cache
215224
</MenuItem>
216225
</MenuGroup>
217226
</MenuPopup>

0 commit comments

Comments
 (0)