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
9 changes: 9 additions & 0 deletions .changeset/fix-open-with-ai-modal-trap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@inkeep/open-knowledge": patch
"@inkeep/open-knowledge-core": patch
"@inkeep/open-knowledge-server": patch
"@inkeep/open-knowledge-app": patch
"@inkeep/open-knowledge-desktop": patch
---

Fix the editor toolbar's "Open with AI" menu freezing the rest of the app in the macOS desktop app. Once the menu became openable on the desktop host, its default modal behavior disabled pointer events on everything outside the menu while it was open. Because the menu lives in the macOS title-bar drag region — where the outside-click that normally dismisses a modal doesn't reliably reach the menu — the only way to close it was to pick an agent, and meanwhile the rest of the chrome (notably the bottom-left project switcher) couldn't be clicked. The menu is now non-modal: opening it no longer blocks the rest of the UI, and clicking anywhere outside dismisses it. Browsers (`ok ui`) are unaffected.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { afterEach, describe, expect, mock, test } from 'bun:test';
import { cleanup, render, screen, waitFor } from '@testing-library/react';
import type { HandoffDispatchInput } from './useHandoffDispatch';

type WindowGlobals = { NodeFilter?: typeof NodeFilter };
type GlobalWithDomShims = typeof globalThis &
WindowGlobals & { window?: WindowGlobals; ResizeObserver?: unknown };
const globalWithDomShims = globalThis as GlobalWithDomShims;
if (
globalWithDomShims.NodeFilter === undefined &&
globalWithDomShims.window?.NodeFilter !== undefined
) {
globalWithDomShims.NodeFilter = globalWithDomShims.window.NodeFilter;
}
if (globalWithDomShims.ResizeObserver === undefined) {
class NoopResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
globalWithDomShims.ResizeObserver = NoopResizeObserver;
}

mock.module('@/lib/config-context', () => ({
useConfigContext: () => ({ merged: null }),
}));
mock.module('./useInstalledAgents', () => ({
useInstalledAgents: () => ({ states: {}, refresh: () => {} }),
}));
mock.module('./useHandoffDispatch', () => ({
useHandoffDispatch: () => ({ dispatch: async () => {}, reinstallCoworkSkill: async () => {} }),
}));

const { OpenInAgentMenu } = await import('./OpenInAgentMenu');

const FILE_INPUT: HandoffDispatchInput = {
docContext: null,
projectDir: '/tmp/project',
docPath: 'note.md',
};

describe('OpenInAgentMenu non-modal contract', () => {
afterEach(() => {
cleanup();
document.body.style.pointerEvents = '';
});

test('opening the menu does not disable outside pointer events (body stays interactive)', async () => {
render(<OpenInAgentMenu input={FILE_INPUT} open onOpenChange={() => {}} />);

await waitFor(() => {
expect(screen.queryByTestId('open-in-agent-menu')).not.toBeNull();
});

expect(document.body.style.pointerEvents).not.toBe('none');
});
});
2 changes: 1 addition & 1 deletion packages/app/src/components/handoff/OpenInAgentMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function OpenInAgentMenu({ input, open, onOpenChange }: OpenInAgentMenuPr
};

return (
<DropdownMenu open={menuOpen} onOpenChange={handleOpenChange}>
<DropdownMenu open={menuOpen} onOpenChange={handleOpenChange} modal={false}>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
Expand Down