Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Ask: resizing the window while Ask closes no longer reopens it over the page

Eric Brownrout5658287150ae
diff --git a/app/e2e/agendaLoading.spec.ts b/app/e2e/agendaLoading.spec.ts
index bcf581e7..6ef91404 100644
--- a/app/e2e/agendaLoading.spec.ts
+++ b/app/e2e/agendaLoading.spec.ts
@@ -141,7 +141,7 @@ test('the compact calendar keeps its original type and geometry with distinct se
await page.emulateMedia({ colorScheme, reducedMotion: 'reduce' })
const accent = colorScheme === 'light' ? 'rgb(111, 0, 255)' : 'rgb(183, 128, 255)'
const fill = 'rgb(111, 0, 255)', white = 'rgb(255, 255, 255)'
- for (const id of ['start-recording', 'recording-choices']) {
+ for (const id of ['new-note', 'recording-choices']) {
const control = page.getByTestId(id)
await expect(control).toHaveCSS('background-color', fill)
await expect(control).toHaveCSS('color', white)
diff --git a/app/e2e/askContext.spec.ts b/app/e2e/askContext.spec.ts
index f0d8c27f..cfd06930 100644
--- a/app/e2e/askContext.spec.ts
+++ b/app/e2e/askContext.spec.ts
@@ -149,8 +149,11 @@ test('the note panel and full conversation expose Rename and a single Delete con
await page.getByTestId('chat-delete').click()
await expect(page.getByTestId('chat-delete-confirm')).toHaveCount(1)
await page.getByTestId('chat-delete-cancel').click()
+ await expect(page.getByTestId('chat-delete-confirm')).toHaveCount(0)
await expect(page.getByTestId('chat-panel')).toBeVisible()
await page.keyboard.press('Escape')
+ await expect(page.getByTestId('chat-panel')).toHaveCount(0)
+ await page.getByTestId('sidebar-expand').press('ArrowDown')
await page.getByTestId('nav-chat').click()
await page.getByTestId('chat-recent').click()
await page.getByTestId('chat-history-item').filter({ hasText: 'Decisions' }).click()
diff --git a/app/e2e/folders.spec.ts b/app/e2e/folders.spec.ts
index d0745696..bff2c47a 100644
--- a/app/e2e/folders.spec.ts
+++ b/app/e2e/folders.spec.ts
@@ -133,6 +133,7 @@ for (const theme of ['light', 'dark'] as const) test(`add existing meetings from
const [first] = await window.yogurt.meetings.cards({ limit: 1 })
await window.yogurt.meetings.rename(first.id, title)
}, longTitle)
+ await page.getByTestId('sidebar-expand').press('ArrowDown')
await newFolder(page, 'Reviews')
const header = page.locator('.folder-page-heading').getByRole('button', { name: 'Add meetings' })
const empty = page.getByTestId('folder-empty').getByRole('button', { name: 'Add meetings' })
diff --git a/app/e2e/loadingAndFeedback.spec.ts b/app/e2e/loadingAndFeedback.spec.ts
index 98c45514..92106e0b 100644
--- a/app/e2e/loadingAndFeedback.spec.ts
+++ b/app/e2e/loadingAndFeedback.spec.ts
@@ -115,8 +115,9 @@ test('Undo stays in its window corner across pages and above the modal backdrop'
await expectCorner()
await page.screenshot({ path: testInfo.outputPath('toast-below-chat.png') })
await page.getByTestId('chat-close').click()
- await expectCorner()
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows().find(w => !w.isDestroyed())!.setSize(820, 740))
+ await expect(page.getByTestId('chat-open')).toHaveAttribute('aria-expanded', 'false')
+ await expectCorner()
await page.getByTestId('chat-open').click()
await expect(page.getByTestId('chat-panel')).toHaveAttribute('aria-modal', 'true')
await expect.poll(async () => {
diff --git a/app/src/renderer/src/components/Chat.tsx b/app/src/renderer/src/components/Chat.tsx
index f018af8b..8b8104d2 100644
--- a/app/src/renderer/src/components/Chat.tsx
+++ b/app/src/renderer/src/components/Chat.tsx
@@ -82,6 +82,11 @@ export function Ask({ id, recording, anchor, onSource }: { id: string; recording
useEffect(() => () => animations.current.forEach((animation) => animation.cancel()), [])
useLayoutEffect(() => {
if (!open || !anchor || !panel.current) return
+ if (closing.current) {
+ // A breakpoint change during exit must finish closing before changing the dialog mode.
+ animations.current.forEach(animation => animation.finish())
+ return
+ }
const dialog = panel.current
const position = () => {
const bounds = anchor.getBoundingClientRect()
diff --git a/app/test/motionInteractions.test.ts b/app/test/motionInteractions.test.ts
index f2997ee6..08fa6461 100644
--- a/app/test/motionInteractions.test.ts
+++ b/app/test/motionInteractions.test.ts
@@ -685,14 +685,16 @@ it.each([[false, false], [true, false], [false, true], [true, true]])('clips the
const shell = node(to, { left: '-1px', top: '-1px', width: `${to.width}px`, height: `${to.height}px`, borderRadius: '12px', opacity: '1' })
const body = node(to, { opacity: '1' })
const input = { focus: vi.fn() }
- const dialog = { ...node(to, { opacity: '1' }), style: { setProperty() {} }, show() {}, showModal() {}, close() {}, querySelector: () => input }
+ const dialog = { ...node(to, { opacity: '1' }), style: { setProperty() {} }, show: vi.fn(), showModal: vi.fn(), close() {}, querySelector: () => input }
const anchor = { getBoundingClientRect: () => to } as HTMLElement
- vi.stubGlobal('window', { matchMedia: (query: string) => ({ matches: query.includes('max-width') ? narrow : reduced }), addEventListener() {}, removeEventListener() {} })
+ const viewport = { matches: narrow, addEventListener: vi.fn() }
+ vi.stubGlobal('window', { matchMedia: (query: string) => query.includes('max-width') ? viewport : { matches: reduced }, addEventListener() {}, removeEventListener() {} })
vi.stubGlobal('innerHeight', 800)
vi.stubGlobal('ResizeObserver', class { observe() {} disconnect() {} })
vi.stubGlobal('getComputedStyle', (element: { computed: Record<string, string> }) => element.computed)
const render = renderer(() => Ask({ id: 'morph', recording: false, anchor, onSource() {} }))
let tree = render()
+ for (const [effect] of vi.mocked(useEffect).mock.calls) effect()
find(tree, 'chat-open').props.ref.current = button
find(tree, 'chat-open').props.onClick()
tree = render()
@@ -704,7 +706,7 @@ it.each([[false, false], [true, false], [false, true], [true, true]])('clips the
const conversation = find(surface, 'AskConversation')
expect(surface.props['aria-hidden']).toBeUndefined()
expect(conversation.props).toMatchObject({ id: '', panel: true, pendingDraftKey: 'meeting/morph' })
- vi.mocked(useLayoutEffect).mock.lastCall![0]()
+ const dispose = vi.mocked(useLayoutEffect).mock.lastCall![0]() as () => void
expect(input.focus).toHaveBeenCalledWith({ preventScroll: true })
const view = renderer(() => AskConversation(conversation.props))()
expect(find(view, 'chat-suggestions')).toBeDefined()
@@ -718,6 +720,16 @@ it.each([[false, false], [true, false], [false, true], [true, true]])('clips the
expect(dialog.animate.mock.lastCall?.[1].duration).toBe(120)
expect(shell.animate).not.toHaveBeenCalled()
expect(shell.style.overflow).toBe('')
+ // Cross the modal breakpoint before the close fade finishes.
+ viewport.matches = !narrow
+ viewport.addEventListener.mock.calls[0][1]()
+ dispose()
+ render()
+ vi.mocked(useLayoutEffect).mock.lastCall![0]()
+ await Promise.resolve()
+ expect(narrow ? dialog.show : dialog.showModal).not.toHaveBeenCalled()
+ expect(find(render(), 'chat-open').props['aria-expanded']).toBe(false)
+ expect(button.focus).toHaveBeenCalledWith({ preventScroll: true })
return
}
const collapsed = { '--ask-left': `${from.left - to.left - 1}px`, '--ask-top': `${from.top - to.top - 1}px`, width: `${from.width}px`, height: `${from.height}px`, borderRadius: '6px' }