Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): keep skill dialogs within viewport (#2933)

Call Whitee62daadadebd
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index aac91946e..f861ddab3 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -160,7 +160,7 @@ jobs:
npm run test:project-order
npm run test:inbox-return
npm run test:badge-triggers
- npm run test:workbench-general -- sidebar-floating.spec.ts desktop-window-chrome.spec.ts
+ npm run test:workbench-general -- sidebar-floating.spec.ts desktop-window-chrome.spec.ts skills-dialog.spec.ts
npm run test:voice-shortcut
npm run test:chat-interactions
npm run test:chat-selection
diff --git a/ui/e2e/workbench-general/skills-dialog.spec.ts b/ui/e2e/workbench-general/skills-dialog.spec.ts
new file mode 100644
index 000000000..9cc23334d
--- /dev/null
+++ b/ui/e2e/workbench-general/skills-dialog.spec.ts
@@ -0,0 +1,137 @@
+import { expect, test, type Locator, type Page } from '@playwright/test';
+
+import { open, serveProduct } from './support';
+
+const MOBILE_SHORT = { width: 390, height: 500 };
+const DESKTOP_SHORT = { width: 1200, height: 500 };
+const REGISTRY_SKILLS = Array.from({ length: 28 }, (_, index) => ({
+ id: `registry-${index}`,
+ name: `skill-with-a-deliberately-long-name-${index}-xxxxxxxxxxxxxxxx`,
+ description: 'A registry fixture with enough content to exercise the dialog scroll boundary.',
+ owner: 'owner-with-a-long-unbroken-identifier',
+ repo: 'repository-with-a-long-unbroken-identifier',
+ tags: ['tag-with-a-long-unbroken-identifier'],
+ stars: index,
+ aiScore: 0.9,
+ aiBreakdown: [],
+ updatedAt: null,
+ installSource: `gh:fixture/repository@skill-${index}`,
+ url: null,
+}));
+const DISCOVERED_SKILLS = Array.from({ length: 26 }, (_, index) => ({
+ name: `discovered-skill-with-a-deliberately-long-name-${index}-xxxxxxxxxxxxxxxx`,
+ description: 'A discovered skill with a long description used to force the Add Skill dialog to scroll.',
+}));
+
+const SESSION = {
+ remote: false,
+ authenticated: true,
+ authorization_state: 'current',
+ instance_kind: 'personal',
+ instance_role: 'owner',
+ capabilities: {
+ is_instance_owner: true,
+ can_read_instance: true,
+ can_chat: true,
+ can_manage_projects: true,
+ can_manage_agents: true,
+ can_manage_instance: true,
+ can_manage_access_members: true,
+ can_use_agents: true,
+ can_use_skills: true,
+ can_use_vault_secrets: true,
+ can_use_show_pages: true,
+ can_use_terminal_files: true,
+ can_use_terminal: true,
+ can_use_files: true,
+ can_use_system: true,
+ },
+};
+
+async function serveSkills(page: Page) {
+ const denied = await serveProduct(page);
+ await page.route('**/api/session', (route) => route.fulfill({ json: SESSION }));
+ await page.route('**/api/skills**', (route) => {
+ const request = route.request();
+ const path = new URL(request.url()).pathname;
+ if (path === '/api/skills' && request.method() === 'GET') {
+ return route.fulfill({ json: { ok: true, skills: [] } });
+ }
+ if (path === '/api/skills/check' && request.method() === 'GET') {
+ return route.fulfill({ json: { ok: true, skills: [] } });
+ }
+ if (path === '/api/skills/find' && request.method() === 'GET') {
+ return route.fulfill({ json: { ok: true, count: REGISTRY_SKILLS.length, skills: REGISTRY_SKILLS } });
+ }
+ if (path === '/api/skills/preview' && request.method() === 'POST') {
+ return route.fulfill({ json: { ok: true, skills: DISCOVERED_SKILLS } });
+ }
+ return route.fallback();
+ });
+ return denied;
+}
+
+async function expectScrollableWithinViewport(dialog: Locator, page: Page, inset: number) {
+ const shell = dialog;
+ const viewport = page.viewportSize()!;
+ const box = await shell.boundingBox();
+ expect(box).not.toBeNull();
+ expect(box!.x).toBeGreaterThanOrEqual(inset);
+ expect(box!.y).toBeGreaterThanOrEqual(inset);
+ expect(box!.x + box!.width).toBeLessThanOrEqual(viewport.width - inset);
+ expect(box!.y + box!.height).toBeLessThanOrEqual(viewport.height - inset);
+
+ const metrics = await shell.evaluate((element) => {
+ const style = getComputedStyle(element);
+ return {
+ clientHeight: element.clientHeight,
+ scrollHeight: element.scrollHeight,
+ overflowX: style.overflowX,
+ overflowY: style.overflowY,
+ };
+ });
+ expect(metrics.scrollHeight).toBeGreaterThan(metrics.clientHeight);
+ expect(metrics.overflowX).toBe('hidden');
+ expect(metrics.overflowY).toBe('auto');
+
+ await shell.evaluate((element) => element.scrollTo(0, element.scrollHeight));
+ return { shell, viewport };
+}
+
+async function expectBottomActionVisible(button: Locator, viewport: { width: number; height: number }) {
+ const box = await button.boundingBox();
+ expect(box).not.toBeNull();
+ expect(box!.y).toBeGreaterThanOrEqual(0);
+ expect(box!.y + box!.height).toBeLessThanOrEqual(viewport.height);
+}
+
+test('custom skill dialogs keep their actions reachable on short viewports', async ({ page }) => {
+ const denied = await serveSkills(page);
+ await page.setViewportSize(MOBILE_SHORT);
+ await open(page, '/skills');
+
+ await page.getByRole('button', { name: 'Browse registry', exact: true }).click();
+ const browse = page.getByRole('dialog').filter({ hasText: 'Browse the askill registry' });
+ await expect(browse).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Add', exact: true })).toHaveCount(REGISTRY_SKILLS.length);
+ await expectScrollableWithinViewport(browse, page, 16);
+ await expectBottomActionVisible(browse.getByRole('button', { name: 'Done', exact: true }), MOBILE_SHORT);
+ await browse.getByRole('button', { name: 'Done', exact: true }).click();
+
+ await page.getByRole('button', { name: 'Add skill', exact: true }).click();
+ const add = page.getByRole('dialog').filter({ hasText: 'Add a skill' });
+ await expect(add).toBeVisible();
+ const initialAddBox = await add.boundingBox();
+ expect(initialAddBox).not.toBeNull();
+ expect(initialAddBox!.height).toBeLessThan(MOBILE_SHORT.height - 32);
+ await add.getByPlaceholder('github.com/owner/repo or gh:owner/repo@skill').fill('github.com/fixture/repository');
+ await add.getByRole('button', { name: 'Fetch', exact: true }).click();
+ await expect(add.getByRole('checkbox')).toHaveCount(DISCOVERED_SKILLS.length);
+ await expectScrollableWithinViewport(add, page, 16);
+ await expectBottomActionVisible(add.getByRole('button', { name: /Install \d+ skill\(s\)/ }), MOBILE_SHORT);
+
+ await page.setViewportSize(DESKTOP_SHORT);
+ await expectScrollableWithinViewport(add, page, 40);
+ await expectBottomActionVisible(add.getByRole('button', { name: /Install \d+ skill\(s\)/ }), DESKTOP_SHORT);
+ expect(denied).toEqual([]);
+});
diff --git a/ui/src/components/workbench/skills/AddSkillDialog.tsx b/ui/src/components/workbench/skills/AddSkillDialog.tsx
index 78ed16ca3..ef31a4bc6 100644
--- a/ui/src/components/workbench/skills/AddSkillDialog.tsx
+++ b/ui/src/components/workbench/skills/AddSkillDialog.tsx
@@ -1,5 +1,5 @@
import { useMemo, useRef, useState } from 'react';
-import { Download, Github, Loader2, PackageCheck, PackagePlus, Search, Terminal, X } from 'lucide-react';
+import { Download, Github, Loader2, PackageCheck, PackagePlus, Search, Terminal } from 'lucide-react';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { useApi } from '../../../context/ApiContext';
@@ -11,6 +11,7 @@ import { Checkbox } from '../../ui/checkbox';
import { FileDropzone } from './FileDropzone';
import { errorMessage } from '@/lib/errorMessage';
import { AGENT_ID_TO_BACKEND } from '@/lib/backendAccent';
+import { Dialog, DialogContent, DialogDescription, DialogTitle } from '../../ui/dialog';
export interface AddSkillDialogProps {
defaultScope: SkillScope;
@@ -168,19 +169,19 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
];
return (
- <div className="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-[#05050B]/[0.72] p-10 backdrop-blur-[6px]">
- <div className="flex w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-border-strong bg-surface-2 shadow-[0_24px_60px_-12px_rgba(0,0,0,0.7)]">
- <div className="flex items-center gap-3 border-b border-border px-5 py-4">
+ <Dialog open onOpenChange={(next) => { if (!next) onClose(); }}>
+ <DialogContent
+ closeLabel={t('common.close')}
+ className="max-w-[560px] w-[calc(100vw-2rem)] gap-0 overflow-y-auto overflow-x-hidden rounded-2xl border-border-strong bg-surface-2 p-0 shadow-[0_24px_60px_-12px_rgba(0,0,0,0.7)] sm:w-[calc(100vw-5rem)] md:top-10 md:max-h-[calc(100dvh-5rem)] md:translate-y-0 max-md:bottom-auto max-md:left-1/2 max-md:right-auto max-md:top-4 max-md:w-[calc(100vw-2rem)] max-md:max-w-none max-md:max-h-[calc(100dvh-2rem)] max-md:translate-x-[-50%] max-md:translate-y-0 max-md:rounded-2xl max-md:p-0 max-md:pb-0"
+ >
+ <div className="flex min-w-0 items-center gap-3 border-b border-border px-5 py-4">
<span className="flex size-[34px] shrink-0 items-center justify-center rounded-[9px] border border-mint/40 bg-mint-soft text-mint-ink">
<PackagePlus className="size-[17px]" />
</span>
- <div className="flex flex-1 flex-col">
- <div className="text-[16px] font-bold text-foreground">{t('skills.addDialog.title')}</div>
- <div className="text-[11px] text-muted">{t('skills.addDialog.subtitle')}</div>
+ <div className="flex min-w-0 flex-1 flex-col">
+ <DialogTitle className="break-words p-0 text-[16px] font-bold text-foreground [overflow-wrap:anywhere]">{t('skills.addDialog.title')}</DialogTitle>
+ <DialogDescription className="break-words text-[11px] text-muted [overflow-wrap:anywhere]">{t('skills.addDialog.subtitle')}</DialogDescription>
</div>
- <button type="button" onClick={onClose} aria-label={t('common.close')} className="flex size-[26px] items-center justify-center rounded-md text-muted transition hover:bg-foreground/[0.06]">
- <X className="size-3.5" />
- </button>
</div>
<div className="flex flex-col gap-4 p-5">
@@ -200,7 +201,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
{source === 'github' ? (
<label className="flex flex-col gap-1.5">
<span className="font-mono text-[10px] font-bold uppercase tracking-[0.1em] text-muted">{t('skills.addDialog.urlLabel')}</span>
- <div className="flex items-center gap-2 rounded-lg border border-border-strong bg-surface px-2.5 py-2">
+ <div className="flex min-w-0 items-center gap-2 rounded-lg border border-border-strong bg-surface px-2.5 py-2">
<Github className="size-3.5 shrink-0 text-muted" />
<input
value={url}
@@ -210,7 +211,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
}}
onKeyDown={(e) => e.key === 'Enter' && fetchGithub()}
placeholder={t('skills.addDialog.urlPlaceholder')}
- className="flex-1 bg-transparent font-mono text-[12px] text-foreground outline-none placeholder:text-muted"
+ className="min-w-0 flex-1 bg-transparent font-mono text-[12px] text-foreground outline-none placeholder:text-muted"
/>
<button
type="button"
@@ -262,7 +263,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
>
<Checkbox checked={on} presentational />
<span className="flex min-w-0 flex-1 flex-col">
- <span className="text-[13px] font-semibold text-foreground">{skill.name}</span>
+ <span className="break-words text-[13px] font-semibold text-foreground [overflow-wrap:anywhere]">{skill.name}</span>
{skill.description ? <span className="truncate text-[11px] text-muted">{skill.description}</span> : null}
</span>
</button>
@@ -277,7 +278,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
</div>
{error ? (
- <div className="rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive-ink">{error}</div>
+ <div className="break-words rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive-ink [overflow-wrap:anywhere]">{error}</div>
) : null}
</div>
@@ -303,7 +304,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
</Button>
</div>
</div>
- </div>
- </div>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/src/components/workbench/skills/BrowseRegistryDialog.tsx b/ui/src/components/workbench/skills/BrowseRegistryDialog.tsx
index 02bfb83e1..42f57fe1a 100644
--- a/ui/src/components/workbench/skills/BrowseRegistryDialog.tsx
+++ b/ui/src/components/workbench/skills/BrowseRegistryDialog.tsx
@@ -1,11 +1,12 @@
import { useEffect, useMemo, useState } from 'react';
-import { Check, Compass, Github, Loader2, Plus, Search, Star, X } from 'lucide-react';
+import { Check, Compass, Github, Loader2, Plus, Search, Star } from 'lucide-react';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { useApi } from '../../../context/ApiContext';
import type { SkillScope, SkillSearchItem } from '../../../context/ApiContext';
import { useToast } from '../../../context/ToastContext';
import { AiScoreBadge } from './QualityMeter';
+import { Dialog, DialogContent, DialogDescription, DialogTitle } from '../../ui/dialog';
import { errorMessage } from '@/lib/errorMessage';
export interface BrowseRegistryDialogProps {
@@ -73,30 +74,30 @@ export function BrowseRegistryDialog({ scope, projectId, installedNames, onClose
};
return (
- <div className="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-[#05050B]/[0.72] p-10 backdrop-blur-[6px]">
- <div className="flex w-full max-w-[760px] flex-col overflow-hidden rounded-2xl border border-border-strong bg-surface-2 shadow-[0_24px_60px_-12px_rgba(0,0,0,0.7)]">
- <div className="flex items-center gap-3 border-b border-border px-5 py-4">
+ <Dialog open onOpenChange={(next) => { if (!next) onClose(); }}>
+ <DialogContent
+ closeLabel={t('common.close')}
+ className="max-w-[760px] w-[calc(100vw-2rem)] gap-0 overflow-y-auto overflow-x-hidden rounded-2xl border-border-strong bg-surface-2 p-0 shadow-[0_24px_60px_-12px_rgba(0,0,0,0.7)] sm:w-[calc(100vw-5rem)] md:top-10 md:max-h-[calc(100dvh-5rem)] md:translate-y-0 max-md:bottom-auto max-md:left-1/2 max-md:right-auto max-md:top-4 max-md:w-[calc(100vw-2rem)] max-md:max-w-none max-md:max-h-[calc(100dvh-2rem)] max-md:translate-x-[-50%] max-md:translate-y-0 max-md:rounded-2xl max-md:p-0 max-md:pb-0"
+ >
+ <div className="flex min-w-0 items-center gap-3 border-b border-border px-5 py-4">
<span className="flex size-[34px] shrink-0 items-center justify-center rounded-[9px] border border-cyan/40 bg-cyan-soft text-cyan-ink">
<Compass className="size-[17px]" />
</span>
- <div className="flex flex-1 flex-col">
- <div className="text-[16px] font-bold text-foreground">{t('skills.browse.title')}</div>
- <div className="text-[11px] text-muted">{t('skills.browse.subtitle')}</div>
+ <div className="flex min-w-0 flex-1 flex-col">
+ <DialogTitle className="break-words p-0 text-[16px] font-bold text-foreground [overflow-wrap:anywhere]">{t('skills.browse.title')}</DialogTitle>
+ <DialogDescription className="break-words text-[11px] text-muted [overflow-wrap:anywhere]">{t('skills.browse.subtitle')}</DialogDescription>
</div>
- <button type="button" onClick={onClose} aria-label={t('common.close')} className="flex size-[26px] items-center justify-center rounded-md text-muted transition hover:bg-foreground/[0.06]">
- <X className="size-3.5" />
- </button>
</div>
<div className="flex flex-col gap-3.5 p-5">
- <div className="flex items-center gap-2.5 rounded-[10px] border border-border-strong bg-surface px-3.5 py-2.5">
- <Search className="size-[15px] text-muted" />
+ <div className="flex min-w-0 items-center gap-2.5 rounded-[10px] border border-border-strong bg-surface px-3.5 py-2.5">
+ <Search className="size-[15px] shrink-0 text-muted" />
<input
autoFocus
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t('skills.browse.searchPlaceholder')}
- className="flex-1 bg-transparent text-[13px] text-foreground outline-none placeholder:text-muted"
+ className="min-w-0 flex-1 bg-transparent text-[13px] text-foreground outline-none placeholder:text-muted"
/>
{loading ? <Loader2 className="size-3.5 animate-spin text-muted" /> : (
<span className="font-mono text-[10.5px] text-muted">{t('skills.browse.resultsCount', { count: results.length })}</span>
@@ -144,10 +145,10 @@ export function BrowseRegistryDialog({ scope, projectId, installedNames, onClose
<div key={String(item.id)} className="flex items-center gap-3 rounded-xl border border-border bg-surface px-3.5 py-3.5">
<div className="flex min-w-0 flex-1 flex-col gap-1.5">
<div className="flex flex-wrap items-center gap-2">
- <span className="text-[14px] font-semibold text-foreground">{item.name}</span>
+ <span className="min-w-0 break-words text-[14px] font-semibold text-foreground [overflow-wrap:anywhere]">{item.name}</span>
<AiScoreBadge score={item.aiScore} />
<Github className="size-3 text-muted" />
- <span className="font-mono text-[10px] text-muted">
+ <span className="min-w-0 break-all font-mono text-[10px] text-muted">
{item.owner}
{item.repo ? `/${item.repo}` : ''}
</span>
@@ -155,7 +156,7 @@ export function BrowseRegistryDialog({ scope, projectId, installedNames, onClose
<div className="line-clamp-2 text-[11.5px] text-muted">{item.description}</div>
<div className="flex flex-wrap items-center gap-2 font-mono text-[10px] text-muted">
{(item.tags ?? []).slice(0, 3).map((tg) => (
- <span key={tg} className="rounded border border-border bg-surface-3 px-1.5 py-0.5">
+ <span key={tg} className="max-w-full break-all rounded border border-border bg-surface-3 px-1.5 py-0.5">
{tg}
</span>
))}
@@ -203,7 +204,7 @@ export function BrowseRegistryDialog({ scope, projectId, installedNames, onClose
{t('skills.browse.done')}
</button>
</div>
- </div>
- </div>
+ </DialogContent>
+ </Dialog>
);
}