Files
substrata/test/section-nav-scroll.test.ts
CatoandClaude Sonnet 5.5 8604900ad2 fix(nav): the section strip no longer scrolls the page back under the finger (#267)
* fix(nav): the section strip no longer scrolls the page back under the finger

SectionNav kept the marked entry visible with scrollIntoView, which scrolls
every ancestor including the page. On the sticky phone strip it threw the
page back ~70px each time the marked section changed, so a swipe fought the
finger. The strip now moves by its own scrollLeft.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* docs(changelog): the page no longer fights the finger (#267)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 15:34:09 +01:00

13 lines
633 B
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
// scrollIntoView scrolls every ancestor, the page included. On the sticky phone
// strip it threw the page back ~70px each time the marked section changed, so
// a swipe fought the finger. The strip must be moved by its own scrollLeft.
test('SectionNav never calls scrollIntoView', () => {
const src = readFileSync(new URL('../components/portal/SectionNav.tsx', import.meta.url), 'utf8');
const code = src.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
assert.doesNotMatch(code, /scrollIntoView/);
});