Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/ui/src/shared/assistant/AssistantPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,21 @@ describe('AssistantPanel', () => {
});
});

it('stays open while the rest of the page is used', async () => {
render(
<>
<button type="button">Elsewhere</button>
<AssistantPanel subject="alex" />
</>,
{ wrapper: createWrapper(new QueryClient()) },
);
await openPanel();

await userEvent.click(screen.getByRole('button', { name: 'Elsewhere' }));

expect(screen.getByRole('dialog', { name: 'Assistant' })).toBeInTheDocument();
});

it('renders nothing while the assistant is switched off', async () => {
server.use(http.get(BASE, () => new HttpResponse(null, { status: 404 })));
const client = new QueryClient();
Expand Down
13 changes: 10 additions & 3 deletions src/ui/src/shared/assistant/AssistantPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface AssistantPanelProps {
}

/**
* The assistant side panel (full-screen sheet on phones), opened through
* The assistant as a floating, non-modal card (full-screen sheet on phones), opened through
* {@link OPEN_ASSISTANT_EVENT}. Stays mounted while closed so a reply keeps streaming.
* Renders nothing while the assistant is switched off. Design §9.
*/
Expand Down Expand Up @@ -111,8 +111,15 @@ export function AssistantPanel({ subject }: AssistantPanelProps) {
}

return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetContent side="right" className="bg-card flex h-full flex-col gap-0 p-0">
// Non-modal: no overlay, the page stays usable; only Escape or the close button dismiss it.
<Sheet open={open} onOpenChange={setOpen} modal={false}>
<SheetContent
side="right"
onInteractOutside={(event) => {
event.preventDefault();
}}
className="bg-card flex h-full flex-col gap-0 p-0 sm:inset-auto sm:right-4 sm:bottom-4 sm:h-160 sm:max-h-[85dvh] sm:w-96 sm:rounded-xl sm:border sm:shadow-xl"
>
<SheetHeader className="border-border border-b pe-12 pb-4">
<SheetTitle>{t('assistant.title')}</SheetTitle>
<SheetDescription>
Expand Down
Loading