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.

summary: while it writes, the reading pane wears Ask's violet ring and follows the newest line; scroll up to pause, Latest to return

Eric Brownrout0e048a653fc3
diff --git a/app/e2e/summaryRim.spec.ts b/app/e2e/summaryRim.spec.ts
new file mode 100644
index 00000000..31866cba
--- /dev/null
+++ b/app/e2e/summaryRim.spec.ts
@@ -0,0 +1,68 @@
+import { _electron as electron, expect, test } from '@playwright/test'
+import { mkdtempSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import type { NoteView } from '../src/shared/types'
+
+for (const theme of ['light', 'dark'] as const) for (const width of [420, 860]) {
+ test(`summary frame follows writing and yields to reading at ${width}px in ${theme}`, async () => {
+ const app = await electron.launch({ args: [join(import.meta.dirname, '../out/main/index.js')], env: {
+ ...process.env, YOGURT_FAKE: '1', YOGURT_BACKGROUND: '1', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), 'yogurt-summary-rim-')),
+ } })
+ try {
+ const page = await app.firstWindow()
+ await expect(page.getByTestId('home')).toBeVisible()
+ const win = await app.browserWindow(page)
+ await win.evaluate(w => w.setContentSize(1200, 850))
+ const id = await app.evaluate(async () => (await (globalThis as unknown as { __fake__: { chatMeetings(): Promise<string[]> } }).__fake__.chatMeetings())[0])
+ await page.evaluate(id => window.yogurt.nav.go(`/note/${id}`), id)
+ await page.emulateMedia({ colorScheme: theme, reducedMotion: 'no-preference' })
+ await page.getByTestId('note-summary-tab').click()
+ await page.locator('.note-layout').evaluate((el, width) => { el.style.flex = 'none'; el.style.width = `${width}px` }, width)
+ const base = await page.evaluate(id => window.yogurt.notes.get(id), id)
+ const push = async (status: NoteView['status'], draft: string) => {
+ const view = { ...base, status, draft, ...(status === 'done' ? { enhanced: draft } : {}) }
+ await app.evaluate(({ BrowserWindow }, view) => {
+ BrowserWindow.getAllWindows().find(w => !w.webContents.getURL().includes('#'))!.webContents.send('notes:changed', view)
+ }, view)
+ }
+ const rim = page.getByTestId('note-summary-rim'), pane = page.locator('#note-notes-panel'), latest = page.getByTestId('note-summary-latest')
+ await push('waiting', '')
+ await expect(rim).toHaveCSS('opacity', '1')
+ await expect(page.getByTestId('note-enhanced-waiting')).toBeVisible()
+ expect(await pane.evaluate(el => el.scrollTop)).toBe(0)
+ const text = (n: number) => Array.from({ length: n }, (_, i) => `## Section ${i + 1}\nThe team agreed to review the launch notes and confirm the next step before publishing.\n`).join('\n')
+ await push('writing', text(18))
+ await expect(page.getByTestId('note-enhanced-editor')).toContainText('Section 18')
+ await expect.poll(() => pane.evaluate(el => el.scrollHeight - el.clientHeight - el.scrollTop)).toBeLessThan(24)
+ await expect(rim).toHaveCSS('opacity', '1')
+ await page.getByTestId('note-transcript-toggle').click()
+ await expect(page.locator('.note-reading-frame')).toBeHidden()
+ expect(await rim.evaluate(el => getComputedStyle(el, '::before').animationPlayState)).toBe('paused')
+ await page.getByTestId('note-summary-tab').click()
+ await pane.evaluate(el => { el.dispatchEvent(new WheelEvent('wheel', { deltaY: -400 })); el.scrollTop = 100 })
+ await expect(latest).toBeVisible()
+ await push('writing', text(22))
+ await expect(page.getByTestId('note-enhanced-editor')).toContainText('Section 22')
+ expect(await pane.evaluate(el => el.scrollTop)).toBeCloseTo(100, 0)
+ await latest.click()
+ await expect(latest).toBeHidden()
+ await expect.poll(() => pane.evaluate(el => el.scrollHeight - el.clientHeight - el.scrollTop)).toBeLessThan(24)
+ await page.emulateMedia({ reducedMotion: 'reduce' })
+ expect(await rim.evaluate(el => getComputedStyle(el, '::before').animationName)).toBe('none')
+ await expect(rim).toHaveCSS('opacity', '1')
+ const before = await pane.boundingBox(), scrollTop = await pane.evaluate(el => el.scrollTop)
+ await push('done', text(22))
+ await expect(rim).toHaveCSS('opacity', '0')
+ await expect(latest).toBeHidden()
+ expect(await pane.boundingBox()).toEqual(before)
+ expect(await pane.evaluate(el => el.scrollTop)).toBeCloseTo(scrollTop, 0)
+ await page.emulateMedia({ reducedMotion: 'no-preference' })
+ expect(await rim.evaluate(el => getComputedStyle(el, '::before').animationPlayState)).toBe('paused')
+ await expect(page.getByTestId('note-summary-tab')).toHaveText('Summary')
+ expect(await page.getByTestId('note-summary-tab').locator('svg').count()).toBe(1)
+ await expect(page.locator('.note-reading-clip')).toHaveCSS('overflow', 'hidden')
+ await expect(page.locator('.note-reading-clip')).toHaveCSS('border-radius', '10px')
+ } finally { await app.close() }
+ })
+}
diff --git a/app/src/renderer/src/components/AskConversation.tsx b/app/src/renderer/src/components/AskConversation.tsx
index 84d90061..66e581fb 100644
--- a/app/src/renderer/src/components/AskConversation.tsx
+++ b/app/src/renderer/src/components/AskConversation.tsx
@@ -16,6 +16,7 @@ import { ConversationActions } from './ConversationActions'
import { ScrollFade } from './ScrollFade'
import { rememberedScroll, useScrollMemory } from '../useScrollMemory'
import { AskContext, chipTitle } from './AskContext'
+import { useFollowLatest } from '../useFollowLatest'
import { Swap, SwapText } from './Swap'
const drafts = new Map<string, string>()
@@ -34,7 +35,6 @@ export function AskConversation({ id, initial, home = false, panel = false, reco
const [error, setError] = useState(false)
const [sending, setSending] = useState(false)
const [changing, setChanging] = useState(false)
- const [behind, setBehind] = useState(false)
const [mention, setMention] = useState<{ start: number; end: number; query: string }>()
const [targetResults, setTargetResults] = useState<{ query: string; items: ContextTarget[] }>()
const targets = targetResults?.items ?? []
@@ -44,7 +44,7 @@ export function AskConversation({ id, initial, home = false, panel = false, reco
const scrollKey = `conversation/${id}`
const scroll = useScrollMemory<HTMLDivElement>(scrollKey, !!chat)
const content = useRef<HTMLDivElement>(null)
- const stuck = useRef(rememberedScroll(scrollKey) === undefined)
+ const follow = useFollowLatest(scroll, content, !!chat, rememberedScroll(scrollKey) === undefined)
const prefix = panel ? 'chat' : 'chat-page'
useEffect(() => {
if (!id) return
@@ -86,18 +86,6 @@ export function AskConversation({ id, initial, home = false, panel = false, reco
useLayoutEffect(() => {
if (!changing && focusAfterRemove.current) { focusAfterRemove.current = false; input.current?.focus() }
}, [changing, chat])
- useLayoutEffect(() => {
- const el = scroll.current, body = content.current
- if (!chat || !el || !body) return
- const follow = () => {
- if (stuck.current) el.scrollTop = el.scrollHeight
- setBehind(el.scrollHeight - el.scrollTop - el.clientHeight >= 24)
- }
- follow()
- const observer = new ResizeObserver(follow)
- observer.observe(body); observer.observe(el)
- return () => observer.disconnect()
- }, [!!chat])
const turns = chat?.turns ?? [], last = turns.at(-1)
const answering = last?.status === 'waiting' || last?.status === 'answering'
const busy = !chat || sending || changing || answering
@@ -139,7 +127,7 @@ export function AskConversation({ id, initial, home = false, panel = false, reco
const send = (q: string) => {
if (!q.trim() || busy) return
keepTyping()
- stuck.current = true; setBehind(false); setSending(true); setError(false); setMention(undefined)
+ follow.resume(); setSending(true); setError(false); setMention(undefined)
void window.yogurt.conversations.ask(id, q).then(made => {
if (!made) throw new Error('Question was not saved')
setText(''); drafts.delete(id)
@@ -173,14 +161,14 @@ export function AskConversation({ id, initial, home = false, panel = false, reco
</div>
</header>}
<div className="ask-thread-wrap">
- <ScrollFade><div className={`ask-thread${panel ? " chat-history" : ""}${unsent ? ' ask-thread-empty' : ''}`} ref={scroll} onScroll={e => { const el = e.currentTarget; stuck.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24; setBehind(!stuck.current) }}>
+ <ScrollFade><div className={`ask-thread${panel ? " chat-history" : ""}${unsent ? ' ask-thread-empty' : ''}`} ref={scroll}>
<div ref={content} className="ask-thread-content">
<LoadingContent pending={!chat && !error} skeleton={<Loading layout="chat" testId="chat-thread-loading" />}>
{!landing && turns.map(turn => <Turn key={turn.id} turn={turn} chat={chat!} panel={panel} onSource={onSource} onRetry={() => send(turn.question)} />)}
{panel && suggestions}</LoadingContent>
</div>
</div></ScrollFade>
- {behind && <button className="chat-latest" data-testid="chat-latest" aria-label={t('Back to latest')} onClick={() => { stuck.current = true; setBehind(false); scroll.current?.scrollTo({ top: scroll.current.scrollHeight, behavior: 'instant' }) }}><ArrowDown size={15} /></button>}
+ {follow.behind && <button className="chat-latest" data-testid="chat-latest" aria-label={t('Back to latest')} onClick={follow.latest}><ArrowDown size={15} /></button>}
</div>
<div className={`ask-composer${panel ? ' chat-composer' : ''}`}>
{error && <p data-testid={panel ? "chat-send-error" : "chat-page-error"} role="alert" className="chat-error">{t("Couldn't save your changes")}</p>}
diff --git a/app/src/renderer/src/components/NoteReadingPane.tsx b/app/src/renderer/src/components/NoteReadingPane.tsx
new file mode 100644
index 00000000..2ff419c9
--- /dev/null
+++ b/app/src/renderer/src/components/NoteReadingPane.tsx
@@ -0,0 +1,32 @@
+import { useEffect, useRef, useState, type ReactNode, type RefObject } from 'react'
+import { ArrowDown } from 'lucide-react'
+import { t } from '../../../shared/i18n'
+import { useFollowLatest } from '../useFollowLatest'
+import { ScrollFade } from './ScrollFade'
+
+export function NoteReadingPane({ active, summary, generating, scroll, children }: {
+ active: boolean; summary: boolean; generating: boolean; scroll: RefObject<HTMLElement | null>; children: ReactNode
+}) {
+ const frame = useRef<HTMLDivElement>(null), content = useRef<HTMLDivElement>(null)
+ const [visible, setVisible] = useState(false)
+ useEffect(() => {
+ if (!active || !generating || !frame.current) { setVisible(false); return }
+ let intersecting = false
+ const sync = () => setVisible(intersecting && !document.hidden)
+ const observer = new IntersectionObserver(([entry]) => { intersecting = entry.isIntersecting; sync() })
+ observer.observe(frame.current)
+ document.addEventListener('visibilitychange', sync)
+ return () => { observer.disconnect(); document.removeEventListener('visibilitychange', sync) }
+ }, [active, generating])
+ const follow = useFollowLatest(scroll, content, active && generating && visible)
+ return <div ref={frame} className="note-reading-frame note-content" hidden={!active} data-generating={generating} data-active={active && generating && visible}>
+ <div className="note-reading-clip">
+ <ScrollFade enabled={active}><section ref={scroll} id="note-notes-panel" role="tabpanel" aria-labelledby={summary ? 'note-summary-tab' : 'note-notes-tab'} className="note-content note-notes-pane">
+ <div ref={content} className="note-page-width note-notes-body">{children}</div>
+ </section></ScrollFade>
+ </div>
+ <span className="ask-border note-summary-rim" data-testid="note-summary-rim" aria-hidden="true" />
+ {generating && !follow.behind && <span className="note-summary-status" aria-hidden="true">{t('Generating notes…')}</span>}
+ {follow.behind && <button type="button" className="note-latest" data-testid="note-summary-latest" onClick={follow.latest}><ArrowDown size={12} aria-hidden="true" />{t('Latest')}</button>}
+ </div>
+}
diff --git a/app/src/renderer/src/followLatest.ts b/app/src/renderer/src/followLatest.ts
new file mode 100644
index 00000000..1e9248a8
--- /dev/null
+++ b/app/src/renderer/src/followLatest.ts
@@ -0,0 +1,49 @@
+import { followGlide } from './motion'
+
+/** Shared by growing answers and summaries; an idle or hidden pane schedules no work. */
+export function attachFollowLatest(el: HTMLElement, body: HTMLElement, stuck: { current: boolean }, behind: (value: boolean) => void) {
+ let glide: ReturnType<typeof followGlide> | undefined
+ const stop = () => { glide?.stop(); glide = undefined }
+ const report = () => behind(el.scrollHeight - el.scrollTop - el.clientHeight >= 24)
+ const follow = () => {
+ if (document.hidden || !el.clientHeight) return
+ if (stuck.current) {
+ if (glide?.active) glide.to(Math.max(0, el.scrollHeight - el.clientHeight))
+ else el.scrollTop = el.scrollHeight
+ }
+ report()
+ }
+ const scroll = () => {
+ if (glide?.active) return
+ stuck.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24
+ report()
+ }
+ const touch = () => { stop() }
+ const key = (event: KeyboardEvent) => {
+ if (['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '].includes(event.key)) stop()
+ }
+ const visibility = () => { if (document.hidden) stop(); else follow() }
+ const observer = new ResizeObserver(follow)
+ observer.observe(body); observer.observe(el)
+ el.addEventListener('scroll', scroll, { passive: true })
+ for (const event of ['wheel', 'touchstart', 'pointerdown']) el.addEventListener(event, touch, { passive: true })
+ el.addEventListener('keydown', key)
+ document.addEventListener('visibilitychange', visibility)
+ follow()
+ return {
+ latest() {
+ stuck.current = true; behind(false)
+ if (document.hidden || !el.clientHeight) return
+ stop()
+ glide = followGlide(el, () => {})
+ glide.to(Math.max(0, el.scrollHeight - el.clientHeight))
+ },
+ dispose() {
+ stop(); observer.disconnect()
+ el.removeEventListener('scroll', scroll)
+ for (const event of ['wheel', 'touchstart', 'pointerdown']) el.removeEventListener(event, touch)
+ el.removeEventListener('keydown', key)
+ document.removeEventListener('visibilitychange', visibility)
+ },
+ }
+}
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index d0f0aef0..5c86d83e 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -1,5 +1,5 @@
import { citationTargetIndex } from '../../../shared/citations'
-import { ScrollFade } from '../components/ScrollFade'
+import { NoteReadingPane } from '../components/NoteReadingPane'
import type { LibrarySource } from '../../../shared/types'
import { flushSync } from 'react-dom'
import { Loading } from '../components/Loading'
@@ -378,17 +378,13 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource }: {
</header>
<div ref={setChatAnchor} className="note-reading-area">
<div ref={panels} className="note-panels">
- <ScrollFade enabled={primary === 'notes'}><section ref={readingScroll} id="note-notes-panel" role="tabpanel" aria-labelledby={shown === 'enhanced' ? 'note-summary-tab' : 'note-notes-tab'} hidden={primary !== 'notes'} className="note-content note-notes-pane">
- <div className="note-page-width note-notes-body">
- <div>
+ <NoteReadingPane active={primary === 'notes'} summary={shown === 'enhanced'} generating={shown === 'enhanced' && (notes.status === 'waiting' || notes.status === 'writing')} scroll={readingScroll}>
{shown === 'mine' ? <Editor
focus={primary === 'notes' && at?.ms === null ? at : undefined} testId="note-mine" label={t('My notes')} className="min-h-[40vh]" markdown={notes.mine} placeholder={t('Write notes here. Yogurt fills in the rest after the meeting.')}
onChange={(md) => { typing.current = true; const next = { ...current.current!, mine: md }; current.current = next; setNotes(next); mineSave.change(md) }}
onBlur={() => { typing.current = false; mineSave.flush() }}
/> : <Enhanced focus={primary === 'notes' && at?.ms === null ? at : undefined} notes={notes} disabled={starting} onChange={(md) => { setEditedHere(true); const next = { ...current.current!, enhanced: md }; current.current = next; setNotes(next); enhancedSave.change(md) }} onBlur={enhancedSave.flush} onRetry={writeAgain} />}
- </div>
- </div>
- </section></ScrollFade>
+ </NoteReadingPane>
{(primary === 'transcript' || transcriptVisited) && <section hidden={primary !== 'transcript'} id="note-transcript-panel" role="tabpanel" aria-labelledby="note-transcript-tab" className="note-content note-transcript-pane">
<Transcript id={id} recording={recording} active={primary === 'transcript'} inline toolbar={transcriptToolbar} focus={at?.ms != null ? { ...at, ms: at.ms } : undefined} />
</section>}
diff --git a/app/src/renderer/src/useFollowLatest.ts b/app/src/renderer/src/useFollowLatest.ts
new file mode 100644
index 00000000..a4a8cda6
--- /dev/null
+++ b/app/src/renderer/src/useFollowLatest.ts
@@ -0,0 +1,20 @@
+import { useLayoutEffect, useRef, useState, type RefObject } from 'react'
+import { attachFollowLatest } from './followLatest'
+
+export function useFollowLatest(scroll: RefObject<HTMLElement | null>, content: RefObject<HTMLElement | null>, enabled: boolean, initiallyFollowing = true) {
+ const stuck = useRef(initiallyFollowing)
+ const controls = useRef<ReturnType<typeof attachFollowLatest> | null>(null)
+ const [behind, setBehind] = useState(false)
+ useLayoutEffect(() => {
+ const el = scroll.current, body = content.current
+ if (!enabled || !el || !body) return
+ const follow = attachFollowLatest(el, body, stuck, setBehind)
+ controls.current = follow
+ return () => { follow.dispose(); controls.current = null }
+ }, [enabled, scroll, content])
+ return {
+ behind: enabled && behind,
+ resume: () => { stuck.current = true; setBehind(false) },
+ latest: () => controls.current?.latest(),
+ }
+}
diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.css
index 16505df6..92eadae8 100644
--- a/app/src/renderer/src/workspace.css
+++ b/app/src/renderer/src/workspace.css
@@ -454,7 +454,8 @@ body:has(.chat-panel[open]) .app-toast-viewport { inset-inline-end:460px; }
.ask-turn:last-child { margin-bottom:0; }
.ask-question { width:fit-content;max-width:80%;margin:0;margin-inline-start:auto;white-space:pre-wrap;overflow-wrap:anywhere;border-radius:12px;background:var(--control);padding:8px 12px;font-size:14px;line-height:20px; }
.ask-composer { flex:none;min-width:0;container-type:inline-size; }
-.ask-box { position:relative;min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--float);box-shadow:var(--shadow-soft);--ask-ring-opacity:0;--ask-ring-play:paused;--ask-ring-color:color-mix(in srgb,var(--accent) 72%,var(--float));--ask-ring-highlight:color-mix(in srgb,var(--focus) 32%,var(--float)); }
+.ask-box { position:relative;min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--float);box-shadow:var(--shadow-soft); }
+.ask-box,.note-reading-frame { --ask-ring-opacity:0;--ask-ring-play:paused;--ask-ring-color:color-mix(in srgb,var(--accent) 72%,var(--float));--ask-ring-highlight:color-mix(in srgb,var(--focus) 32%,var(--float)); }
/* A stationary 2px mask clips one rotating highlight; sending pauses it and fades the ring away. */
.ask-border { position:absolute;inset:-1px;border-radius:inherit;padding:2px;overflow:hidden;pointer-events:none;opacity:var(--ask-ring-opacity);background:var(--ask-ring-color);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask-composite:exclude;transition:opacity 200ms ease-out; }
.ask-border::before { content:"";position:absolute;left:50%;top:50%;width:200%;aspect-ratio:1;background:conic-gradient(transparent 0 54%,var(--ask-ring-highlight) 76%,var(--ask-ring-highlight) 81%,transparent 100%);animation:ask-border-drift 12s linear infinite;animation-play-state:var(--ask-ring-play); }
@@ -464,11 +465,11 @@ body:has(.chat-panel[open]) .app-toast-viewport { inset-inline-end:460px; }
.ask-box:not([data-busy=true]):has(textarea:focus) { --ask-ring-opacity:1;--ask-ring-play:running; }
@media (prefers-color-scheme:dark) {
/* deep enough for a white arrow on the matching send button, light enough to read on the dark surface */
- .ask-box { --ask-ring-color:color-mix(in srgb,var(--primary) 35%,var(--accent));--ask-ring-highlight:color-mix(in srgb,var(--focus) 18%,var(--ink)); }
- .ask-box::before { content:"";position:absolute;inset:-2px;border-radius:inherit;pointer-events:none;opacity:var(--ask-ring-opacity);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 9%,transparent),0 0 12px 2px color-mix(in srgb,var(--accent) 16%,transparent);transition:opacity 200ms ease-out; }
+ .ask-box,.note-reading-frame { --ask-ring-color:color-mix(in srgb,var(--primary) 35%,var(--accent));--ask-ring-highlight:color-mix(in srgb,var(--focus) 18%,var(--ink)); }
+ .ask-box::before,.note-reading-frame::before { content:"";position:absolute;inset:-2px;border-radius:inherit;pointer-events:none;opacity:var(--ask-ring-opacity);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 9%,transparent),0 0 12px 2px color-mix(in srgb,var(--accent) 16%,transparent);transition:opacity 200ms ease-out; }
}
@keyframes ask-border-drift { from { transform:translate(-50%,-50%) rotate(0deg); } to { transform:translate(-50%,-50%) rotate(360deg); } }
-@media (prefers-reduced-motion:reduce) { .ask-border::before { animation:none;display:none; } .ask-box::before { display:none; } .orb-material::before,.orb-material::after { animation:none; } .ask-send { transition:none;transform:none!important; } }
+@media (prefers-reduced-motion:reduce) { .ask-border::before { animation:none;display:none; } .ask-box::before,.note-reading-frame::before { display:none; } .orb-material::before,.orb-material::after { animation:none; } .ask-send { transition:none;transform:none!important; } }
.ask-field { padding:16px 10px 12px; }
.ask-box textarea { display:block;width:100%;field-sizing:content;min-height:38px;max-height:160px;resize:none;background:transparent;outline:none;color:var(--ink);font-size:14px;line-height:22px; }
.ask-box textarea:focus-visible { outline:none; }
@@ -570,3 +571,19 @@ body:has(.chat-panel[open]) .app-toast-viewport { inset-inline-end:460px; }
:root[data-chrome=overlay] .home-toolbar-action { right:calc(17px + var(--controls-end)); }
:root[data-chrome=overlay] .note-topbar { right:calc(16px + var(--controls-end)); }
:root[data-chrome=overlay] .sidebar-collapsed .workspace-toolbar { padding-inline-start:24px; }
+
+/* The frame preserves the note's existing text inset and 22px heading offset in every state. */
+.note-reading-frame { position:relative;min-width:0;margin:8px calc(max(0px,(100% - 860px)/2) + clamp(20px,calc(10cqw - 42px),48px) - 14px) 8px;padding:2px;border-radius:12px; }
+.note-reading-frame[hidden] { display:none; }
+.note-reading-frame[data-generating=true] { --ask-ring-opacity:1; }
+.note-reading-frame[data-active=true] { --ask-ring-play:running; }
+.note-reading-clip { height:100%;overflow:hidden;border-radius:10px; }
+.main-window .note-reading-clip>.note-notes-pane { height:100%;scrollbar-width:auto;scrollbar-gutter:stable; }
+/* The reserved 4px thumb completes the end padding without narrowing or shifting the text column. */
+.note-reading-frame .note-notes-body { max-width:none;padding-block:12px 30px;padding-inline:12px 8px; }
+.note-reading-clip>.note-notes-pane::-webkit-scrollbar { width:4px; }
+.note-reading-clip>.note-notes-pane::-webkit-scrollbar-track,.note-reading-clip>.note-notes-pane::-webkit-scrollbar-thumb { background:transparent; }
+.note-reading-clip>.note-notes-pane[data-scrolling]::-webkit-scrollbar-thumb { background:color-mix(in srgb,var(--muted) 45%,transparent);border-radius:3px; }
+.note-summary-rim { inset:0;z-index:2; }
+.note-summary-status { position:absolute;inset-inline-start:14px;bottom:10px;z-index:1;background:var(--bg);color:var(--muted);font-size:11px;line-height:16px;pointer-events:none; }
+.note-latest { position:absolute;bottom:10px;left:50%;transform:translateX(-50%);z-index:3;display:flex;align-items:center;gap:4px;border:1px solid var(--line);border-radius:6px;padding:4px 12px;background:var(--float);color:var(--ink);font-size:12px;line-height:16px;box-shadow:var(--shadow); }
diff --git a/app/test/followLatest.test.ts b/app/test/followLatest.test.ts
new file mode 100644
index 00000000..d7f8e1e0
--- /dev/null
+++ b/app/test/followLatest.test.ts
@@ -0,0 +1,78 @@
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+import { attachFollowLatest } from '../src/renderer/src/followLatest'
+import { followGlide } from '../src/renderer/src/motion'
+
+vi.mock('../src/renderer/src/motion', () => ({ followGlide: vi.fn() }))
+class Pane extends EventTarget {
+ scrollHeight = 1200
+ clientHeight = 400
+ top = 0
+ get scrollTop() { return this.top }
+ set scrollTop(value: number) { this.top = Math.max(0, Math.min(value, this.scrollHeight - this.clientHeight)) }
+}
+class Resize {
+ static current: Resize
+ observe = vi.fn()
+ disconnect = vi.fn()
+ constructor(public change: () => void) { Resize.current = this }
+}
+let doc: EventTarget & { hidden: boolean }
+beforeEach(() => {
+ doc = Object.assign(new EventTarget(), { hidden: false })
+ vi.stubGlobal('document', doc); vi.stubGlobal('ResizeObserver', Resize)
+ vi.mocked(followGlide).mockClear()
+})
+afterEach(() => vi.unstubAllGlobals())
+function setup(initial = true) {
+ const pane = new Pane(), body = new Pane(), state = { current: initial }, behind = vi.fn()
+ const follow = attachFollowLatest(pane as unknown as HTMLElement, body as unknown as HTMLElement, state, behind)
+ return { pane, state, behind, follow }
+}
+it('shares resize-driven following, the 24px threshold and reading-earlier preservation', () => {
+ const { pane, state, behind, follow } = setup()
+ expect(pane.scrollTop).toBe(800)
+ expect(Resize.current.observe).toHaveBeenCalledTimes(2)
+ pane.scrollHeight = 1400; Resize.current.change(); expect(pane.scrollTop).toBe(1000)
+ pane.scrollTop = 976; pane.dispatchEvent(new Event('scroll')); expect(state.current).toBe(false)
+ pane.scrollHeight = 1600; Resize.current.change(); expect(pane.scrollTop).toBe(976)
+ expect(behind).toHaveBeenLastCalledWith(true)
+ pane.scrollTop = 1177; pane.dispatchEvent(new Event('scroll')); expect(state.current).toBe(true)
+ Resize.current.change(); expect(pane.scrollTop).toBe(1200)
+ expect(followGlide).not.toHaveBeenCalled()
+ follow.dispose()
+})
+it('keeps a remembered reading position rather than jumping on attachment', () => {
+ const { pane, follow } = setup(false)
+ expect(pane.scrollTop).toBe(0)
+ follow.dispose()
+})
+it('Latest reuses the finite glide, retargets arrivals and yields to user input', () => {
+ let active = true
+ const glide = { to: vi.fn(), stop: vi.fn(() => { active = false }), get active() { return active } }
+ vi.mocked(followGlide).mockReturnValue(glide)
+ const { pane, state, behind, follow } = setup(false)
+ follow.latest(); expect(state.current).toBe(true); expect(behind).toHaveBeenLastCalledWith(false)
+ expect(glide.to).toHaveBeenLastCalledWith(800)
+ pane.scrollTop = 300; pane.dispatchEvent(new Event('scroll')); expect(state.current).toBe(true)
+ pane.scrollHeight = 1400; Resize.current.change(); expect(glide.to).toHaveBeenLastCalledWith(1000)
+ pane.dispatchEvent(new Event('wheel')); expect(glide.stop).toHaveBeenCalledOnce()
+ pane.scrollTop = 150; pane.dispatchEvent(new Event('scroll'))
+ pane.scrollHeight = 1600; Resize.current.change(); expect(pane.scrollTop).toBe(150)
+ follow.dispose()
+})
+it('stops on hiding or completion cleanup, with no polling or work after disposal', () => {
+ const glide = { to: vi.fn(), stop: vi.fn(), active: true }
+ vi.mocked(followGlide).mockReturnValue(glide)
+ const { pane, follow } = setup(false)
+ follow.latest(); doc.hidden = true; doc.dispatchEvent(new Event('visibilitychange'))
+ expect(glide.stop).toHaveBeenCalledOnce()
+ pane.scrollHeight = 1800; Resize.current.change(); expect(pane.scrollTop).toBe(0)
+ follow.dispose(); expect(Resize.current.disconnect).toHaveBeenCalledOnce()
+ doc.hidden = false; doc.dispatchEvent(new Event('visibilitychange')); expect(pane.scrollTop).toBe(0)
+})
+it('does not move a collapsed pane', () => {
+ const { pane, follow } = setup()
+ pane.clientHeight = 0; pane.scrollHeight = 2000; Resize.current.change()
+ expect(pane.scrollTop).toBe(800)
+ follow.dispose()
+})