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
29 changes: 29 additions & 0 deletions docs/plans/2026-10-29-topbar-scroll-glitch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Topbar scroll glitch

Scrolling down and back to the top shows visual glitches in the top bar and the
Home/History/Dictionary/Settings navigation: content shows through (reported
with the mouse wheel).

- [x] Reproduce the glitch in WebKitGTK (the engine the Tauri app uses) with captured frames
- [x] Identify the root cause from the reproduction
- [x] Failing test: switching views resets the scroll position of `main`
- [x] Shell layout: only `main` scrolls, topbar and nav are not sticky; scroll reset targets `main`
- [x] Same reproduction no longer shows the glitch
- [x] e2e fit check also covers horizontal overflow inside `main`
- [x] Frontend CI checks pass locally (typecheck, lint, tests, responsive e2e)
- [ ] PR filed, reviews addressed, required checks green
- [ ] PR merged

## Findings

- Reproduced only on native Wayland (in-process capture of the frames WebKit
hands to GTK while sending smooth wheel deltas). XWayland and Xvfb never
showed it.
- Baseline: 12, 27 (920 wide) and 22 (1280 wide) of 420 frames had the sticky
topbar or nav drawn out of place with content showing through.
- `content-visibility: visible` on transcript rows: 11 and 20 of 420, so not the cause.
- Only `main` scrolling (bars not sticky): 0 of 420 in three runs, at 920 and 1280.
- The user confirmed on their machine: the glitch shows in the old build and not in the fixed one.
- Screen recordings of the user's own mouse scrolling on Home (GNOME screencast,
bar region checked frame by frame): old build 21 of 1558 frames with the top
bar displaced 15 to 30px; fixed build 0 of 1515.
8 changes: 5 additions & 3 deletions frontend/e2e/ui-design.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ async function capture(page: Page, info: TestInfo, name: string) {
}

async function expectFits(page: Page) {
expect(await page.evaluate(() =>
document.documentElement.scrollWidth <= document.documentElement.clientWidth,
)).toBe(true)
expect(await page.evaluate(() => {
const fits = (node: Element) => node.scrollWidth <= node.clientWidth
const main = document.querySelector('main.main-content')
return fits(document.documentElement) && main !== null && fits(main)
})).toBe(true)
}

for (const theme of ['light', 'dark']) {
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ describe('Echo desktop shell', () => {
expect(screen.getByPlaceholderText('Search transcripts…')).toBeInTheDocument()
})

it('opens each view at the top of the scrolling content area', async () => {
render(<App />)
const main = screen.getByRole('main')
main.scrollTop = 240

fireEvent.click(screen.getByRole('button', { name: 'History' }))

expect(await screen.findByRole('heading', { name: 'History' })).toBeInTheDocument()
expect(main.scrollTop).toBe(0)
})

it('focuses the scrolling content area so the keyboard scrolls it', async () => {
render(<App />)
const main = screen.getByRole('main')
expect(main).toHaveFocus()

const history = screen.getByRole('button', { name: 'History' })
history.focus()
fireEvent.click(history)

expect(await screen.findByRole('heading', { name: 'History' })).toBeInTheDocument()
expect(main).toHaveFocus()
})

it.each([
['Transcribing', 'Transcribing locally…', 'Whisper · small · VAD on is turning your recording into text.'],
['Injecting', 'Inserting transcript…', 'ydotool · Wayland is sending your transcript to the active app.'],
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Power,
Settings,
} from 'lucide-react'
import { useEffect, useRef } from 'react'
import { BrandMark, StatusPill } from './app/chrome'
import { useAppController } from './app/useAppController'
import { DictionaryView } from './dictionary/DictionaryView'
Expand Down Expand Up @@ -47,6 +48,14 @@ function App() {
removeDictionaryEntry,
} = useAppController()
const shortcut = presentShortcut(status.shortcut)
const mainRef = useRef<HTMLElement>(null)

// main is the only scroller, so it needs focus for keyboard scrolling.
useEffect(() => {
if (!mainRef.current) return
mainRef.current.scrollTop = 0
mainRef.current.focus({ preventScroll: true })
}, [view])

return (
<div className="app-shell">
Expand Down Expand Up @@ -103,7 +112,7 @@ function App() {
</div>
</nav>

<main className="main-content">
<main ref={mainRef} className="main-content" tabIndex={-1}>
{error ? (
<div className="error-banner" role="alert">
<CircleAlert size={17} aria-hidden="true" />
Comment thread
sentry[bot] marked this conversation as resolved.
Resolved
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/app/useAppController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ export function useAppController() {
return () => media.removeEventListener('change', apply)
}, [theme])

useEffect(() => {
window.scrollTo({ top: 0, left: 0, behavior: 'auto' })
}, [view])

const toggle = useCallback(async () => {
const { phase, recordingSessionId } = recordingObservation.current.snapshot
const processing = phase === 'Transcribing' || phase === 'Injecting'
Expand Down
22 changes: 13 additions & 9 deletions frontend/src/styles/shell.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.app-shell {
min-height: 100vh;
display: flex;
height: 100vh;
flex-direction: column;
overflow: hidden;
background: hsl(var(--surface-app));
}

.topbar {
position: sticky;
z-index: 20;
top: 0;
display: flex;
min-height: 4rem;
flex: none;
align-items: center;
justify-content: space-between;
gap: var(--space-4);
Expand Down Expand Up @@ -104,17 +105,15 @@

.workspace {
display: grid;
min-height: calc(100vh - 4rem);
min-height: 0;
flex: 1;
grid-template-columns: 12rem minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
}

.sidebar {
position: sticky;
top: 4rem;
display: flex;
height: calc(100vh - 4rem);
min-width: 0;
align-self: start;
flex-direction: column;
justify-content: space-between;
border-right: 1px solid hsl(var(--border-subtle));
Expand Down Expand Up @@ -195,9 +194,14 @@

.main-content {
min-width: 0;
overflow-y: auto;
padding: var(--space-6);
}

.main-content:focus {
outline: none;
}

.error-banner {
display: flex;
align-items: center;
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/styles/view-responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
.topbar { padding-inline: var(--space-4); }
.workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
.sidebar {
position: sticky;
z-index: 15;
top: 4rem;
display: block;
height: auto;
border-right: 0;
border-bottom: 1px solid hsl(var(--border-subtle));
padding: var(--space-2) var(--space-3);
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,3 @@ Object.defineProperty(window, 'matchMedia', {
dispatchEvent: () => false,
}),
})

Object.defineProperty(window, 'scrollTo', {
writable: true,
value: () => {},
})
Loading