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.

Folders: the suggested folder keeps its place in the list, tagged Suggested, and the keyboard starts on it

christianmat9d23b7cecaef
diff --git a/app/e2e/folders.spec.ts b/app/e2e/folders.spec.ts
index 8d1e26e1..b1a325df 100644
--- a/app/e2e/folders.spec.ts
+++ b/app/e2e/folders.spec.ts
@@ -125,7 +125,7 @@ test('a note goes into folders from its menu and its chip, and a new folder from
await expect(page.getByTestId('folder-suggestion')).toHaveText('Acme')
await expect(folder(page, 'Acme').getByTestId('sidebar-folder-count')).toHaveText('0')
await page.getByTestId('note-folders').click()
- const suggested = page.getByTestId('folder-chip-list').getByTestId('folder-option').first()
+ const suggested = page.getByTestId('folder-chip-list').getByTestId('folder-option').filter({ hasText: 'Suggested' })
await expect(suggested).toHaveText('AcmeSuggested')
await expect(suggested).toHaveAttribute('aria-checked', 'false')
await page.keyboard.press('Escape')
@@ -265,7 +265,7 @@ for (const input of ['pointer', 'keyboard'] as const) test(`the suggested row na
} else await row.getByTestId('note-folders').click()
await expect(page.getByTestId('home')).toBeVisible()
const picker = page.getByTestId('meeting-row-folders')
- await expect(picker.getByTestId('folder-option').first()).toHaveText('AcmeSuggested')
+ await expect(picker.getByTestId('folder-option').filter({ hasText: 'Suggested' })).toHaveText('AcmeSuggested')
await picker.getByRole('menuitemcheckbox', { name: 'Alpha', exact: true }).click()
await expect(row.getByTestId('past-note-folder')).toHaveText('Alpha')
await expect(row.getByTestId('folder-suggestion')).toHaveCount(0)
@@ -307,10 +307,10 @@ for (const colorScheme of ['light', 'dark'] as const) test(`the divided suggesti
expect(await label.evaluate(el => el.scrollWidth > el.clientWidth)).toBe(true)
expect((await proposal.boundingBox())!.width).toBeLessThanOrEqual(256)
await page.getByTestId('note-folders').click()
- const options = page.getByTestId('folder-chip-list').getByTestId('folder-option')
- await expect(options.first()).toHaveText(`${name}Suggested`)
- await expect(options.first()).toBeFocused()
- await expect(options.first()).toHaveAttribute('aria-checked', 'false')
+ const options = page.getByTestId('folder-chip-list').getByTestId('folder-option').filter({ hasText: 'Suggested' })
+ await expect(options).toHaveText(`${name}Suggested`)
+ await expect(options).toBeFocused()
+ await expect(options).toHaveAttribute('aria-checked', 'false')
await page.keyboard.press('Escape')
await expect(page.getByTestId('note-folders')).toBeFocused()
await page.getByTestId('folder-suggestion-cancel').click()
diff --git a/app/src/renderer/src/components/FolderPicker.tsx b/app/src/renderer/src/components/FolderPicker.tsx
index 400b3610..d41cab47 100644
--- a/app/src/renderer/src/components/FolderPicker.tsx
+++ b/app/src/renderer/src/components/FolderPicker.tsx
@@ -17,8 +17,9 @@ export function FolderPicker({ meetingId, meetingIds, memberships, suggestedId,
const all = useFolders()
const list = useRef<HTMLDivElement>(null)
const loaded = all !== undefined
+ // the suggested folder keeps its place in the list (only tagged); the keyboard starts on it, so Enter takes it
useEffect(() => {
- if (autoFocus && loaded) list.current?.querySelector<HTMLElement>('[role="menuitemcheckbox"], [role="menuitem"]')?.focus()
+ if (autoFocus && loaded) (list.current?.querySelector<HTMLElement>('[data-suggested]') ?? list.current?.querySelector<HTMLElement>('[role="menuitemcheckbox"], [role="menuitem"]'))?.focus()
}, [autoFocus, loaded])
const mine = useFolders(memberships ? null : meetingId)
const ids = useMemo(() => meetingIds ?? (meetingId ? [meetingId] : []), [meetingIds, meetingId])
@@ -42,9 +43,8 @@ export function FolderPicker({ meetingId, meetingIds, memberships, suggestedId,
} finally { saving.current = false }
}
const row = 'flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-start text-sm hover:bg-[var(--line)] focus-visible:bg-[var(--line)] focus-visible:outline-none'
- const ordered = suggestedId ? all?.filter(s => s.id === suggestedId).concat(all.filter(s => s.id !== suggestedId)) : all
return <div ref={list} data-testid={testId} role="group" aria-label={t('Folders')}>
- {ordered?.map((s) => <button key={s.id} role="menuitemcheckbox" aria-checked={inIt(s.id)} aria-disabled={busy || (!memberships && !mine)} data-testid="folder-option" onClick={() => void toggle(s.id)} className={row}>
+ {all?.map((s) => <button key={s.id} data-suggested={s.id === suggestedId || undefined} role="menuitemcheckbox" aria-checked={inIt(s.id)} aria-disabled={busy || (!memberships && !mine)} data-testid="folder-option" onClick={() => void toggle(s.id)} className={row}>
<FolderGlyph appearance={s} size={15} />
<span className="min-w-0 flex-1 truncate">{s.name}</span>
{s.id === suggestedId && <span className="shrink-0 text-[10px] text-muted">{t('Suggested')}</span>}
diff --git a/app/test/folderChip.test.ts b/app/test/folderChip.test.ts
index 15639519..8d69fd10 100644
--- a/app/test/folderChip.test.ts
+++ b/app/test/folderChip.test.ts
@@ -89,10 +89,10 @@ it('switches the note straight from the suggestion to its normal folder chip', (
expect(filed).not.toContain('Add to folder</span>')
})
-it('puts the suggested folder first without selecting it or changing the normal picker order', () => {
+it('tags the suggested folder where it already sits in the list, without moving or selecting it', () => {
const picker = (suggestedId?: string) => renderToStaticMarkup(createElement(FolderPicker, { meetingId: 'meeting', suggestedId, testId: 'picker', onNew() {} }))
const html = picker(suggested.id)
- expect(html.indexOf(suggested.name)).toBeLessThan(html.indexOf('Alpha'))
+ expect(html.indexOf('Alpha')).toBeLessThan(html.indexOf(suggested.name))
expect(html).toContain('>Suggested</span>')
expect(html.match(/aria-checked="false"/g)).toHaveLength(2)
const normal = picker()