From 8102bc94773dbad00ea57f0a7c2d1f1c12614719 Mon Sep 17 00:00:00 2001 From: vriesd Date: Thu, 29 Oct 2026 07:56:10 +0100 Subject: [PATCH 1/3] fix: keep the top bar and navigation still while scrolling The page scrolled as a whole with the top bar and navigation pinned by position: sticky. On native Wayland, WebKitGTK repositions sticky layers separately from the scrolled content, so during smooth wheel scrolling some frames drew the bars partly scrolled away with content showing through. The shell now fills the window and only main scrolls, so the bars no longer move. Switching views resets main's scroll position instead of the window's, and the e2e fit check now also covers horizontal overflow inside main. --- docs/plans/2026-10-29-topbar-scroll-glitch.md | 26 +++++++++++++++++++ frontend/e2e/ui-design.spec.ts | 8 +++--- frontend/src/App.test.tsx | 11 ++++++++ frontend/src/App.tsx | 8 +++++- frontend/src/app/useAppController.ts | 4 --- frontend/src/styles/shell.css | 18 ++++++------- frontend/src/styles/view-responsive.css | 4 --- frontend/src/test/setup.ts | 5 ---- 8 files changed, 58 insertions(+), 26 deletions(-) create mode 100644 docs/plans/2026-10-29-topbar-scroll-glitch.md diff --git a/docs/plans/2026-10-29-topbar-scroll-glitch.md b/docs/plans/2026-10-29-topbar-scroll-glitch.md new file mode 100644 index 00000000..b84c71b0 --- /dev/null +++ b/docs/plans/2026-10-29-topbar-scroll-glitch.md @@ -0,0 +1,26 @@ +# 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. diff --git a/frontend/e2e/ui-design.spec.ts b/frontend/e2e/ui-design.spec.ts index 661867d5..8a5bcf3f 100644 --- a/frontend/e2e/ui-design.spec.ts +++ b/frontend/e2e/ui-design.spec.ts @@ -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']) { diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx index cf659415..b23f1280 100644 --- a/frontend/src/App.test.tsx +++ b/frontend/src/App.test.tsx @@ -185,6 +185,17 @@ describe('Echo desktop shell', () => { expect(screen.getByPlaceholderText('Search transcripts…')).toBeInTheDocument() }) + it('opens each view at the top of the scrolling content area', async () => { + render() + 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.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.'], diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 8b85e95c..fd5453ab 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -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' @@ -47,6 +48,11 @@ function App() { removeDictionaryEntry, } = useAppController() const shortcut = presentShortcut(status.shortcut) + const mainRef = useRef(null) + + useEffect(() => { + if (mainRef.current) mainRef.current.scrollTop = 0 + }, [view]) return (
@@ -103,7 +109,7 @@ function App() {
-
+
{error ? (
-
+
{error ? (