Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): cover reads banner alias + drag focal position (PRD-7671) (#3164)

Abrahamf2181f8833d4
diff --git a/.changeset/banner-cover-focal-position.md b/.changeset/banner-cover-focal-position.md
new file mode 100644
index 000000000..828138eea
--- /dev/null
+++ b/.changeset/banner-cover-focal-position.md
@@ -0,0 +1,5 @@
+---
+'@inkeep/open-knowledge-app': minor
+---
+
+Page-top cover images now read `banner:` in addition to `cover:` (Obsidian vaults with `banner`/`banner_y` plugin frontmatter light up without a rename). Adds a vertical focal-position control: drag the cover up or down to reframe, or focus it and use arrow keys / Home / End for keyboard adjustment. The chosen position writes to `banner_y` (or `cover_y`, matching the source key) as a 0.0–1.0 float, the Obsidian convention.
diff --git a/packages/app/src/components/FrontmatterRow.tsx b/packages/app/src/components/FrontmatterRow.tsx
index aa5ab790f..9a0701c84 100644
--- a/packages/app/src/components/FrontmatterRow.tsx
+++ b/packages/app/src/components/FrontmatterRow.tsx
@@ -733,7 +733,11 @@ function Widget({ keyName, value, widgetType, path, onCommit, onSubmit }: Widget
const str = typeof value === 'string' ? value : '';
return <PageIconWidget keyName={keyName} value={str} onCommit={onCommit} />;
}
- if (keyName === 'cover') {
+ // `banner` is the Obsidian-plugin convention (Pixel Banner / Obsidian
+ // Banners); `cover` is the Notion vocabulary. Both route through the same
+ // widget so vaults migrated from either surface get the file-picker UX
+ // without a rename.
+ if (keyName === 'cover' || keyName === 'banner') {
const str = typeof value === 'string' ? value : '';
return <PageCoverWidget keyName={keyName} value={str} onCommit={onCommit} />;
}
diff --git a/packages/app/src/components/PageHeader.tsx b/packages/app/src/components/PageHeader.tsx
index c287af830..52f7fda14 100644
--- a/packages/app/src/components/PageHeader.tsx
+++ b/packages/app/src/components/PageHeader.tsx
@@ -1,9 +1,17 @@
/**
* PageHeader — the cover banner + page-icon surface above the editor body.
*
- * Reads `icon` + `cover` from the document's frontmatter (Y.Text('source')
- * YAML region) via the same `bindFrontmatterDoc` binding `PropertyPanel`
- * uses. Renders three states (driven by which frontmatter keys resolve to
+ * Reads `icon` + (`banner` ?? `cover`) from the document's frontmatter
+ * (Y.Text('source') YAML region) via the same `bindFrontmatterDoc` binding
+ * `PropertyPanel` uses. `banner` (Obsidian convention) is preferred over
+ * `cover` (Notion convention) — vaults imported from either substrate render
+ * without a rename. When only one is set, that key wins.
+ *
+ * Vertical focal position (`banner_y` / `cover_y`, 0.0–1.0) rides on the
+ * source key. A drag interaction on the cover updates the paired `_y` key —
+ * commit-on-release, single CRDT write per drag.
+ *
+ * Renders three states (driven by which frontmatter keys resolve to
* supported values per `page-header-utils.ts`):
*
* 1. **cover + icon**: full-width cover banner; icon overlays the bottom-
@@ -20,20 +28,27 @@
* Y.Doc lifecycle of the open document AND scrolls with the editor
* body (precedent #18(b) — keep all per-doc UI inside the boundary).
*
- * The `aria-hidden` attribute marks the header as decoration; the
- * H1 inside the TipTap body remains the document's actual title. This
- * avoids fighting screen readers over which surface to announce.
+ * The H1 inside the TipTap body remains the document's actual title —
+ * assistive tech sees the drag slider (a real interactive control with
+ * `role="slider"` + keyboard support) as the only exposed element in this
+ * region; the decorative cover image and icon are unnamed `<img>` tags with
+ * empty alt.
*/
import type { HocuspocusProvider } from '@hocuspocus/provider';
import {
bindFrontmatterDoc,
+ type FrontmatterBinding,
type FrontmatterSnapshot,
readFmKeys,
readFmRegionWithError,
} from '@inkeep/open-knowledge-core';
-import { useEffect, useState } from 'react';
+import { useLingui } from '@lingui/react/macro';
+import { useEffect, useRef, useState } from 'react';
import {
+ focalYToObjectPosition,
+ parseFocalY,
+ pickCoverKey,
type ResolvedPageCover,
type ResolvedPageIcon,
resolvePageCover,
@@ -62,14 +77,13 @@ export function PageHeader({ provider }: PageHeaderProps) {
const [snapshot, setSnapshot] = useState<FrontmatterSnapshot>(() =>
readInitialSnapshot(provider),
);
+ // Kept in a ref so the drag handler can commit into it without the
+ // component needing to re-render on binding creation.
+ const bindingRef = useRef<FrontmatterBinding | null>(null);
useEffect(() => {
- // Closure-scoped binding — there is no consumer that reads the
- // binding from React state, so a `useState` slot would just pay
- // for an extra unmount-time render. Lifecycle is bounded by the
- // effect: `subscribe()` runs while mounted, `unsub()` + `dispose()`
- // run on cleanup.
const next = bindFrontmatterDoc(provider);
+ bindingRef.current = next;
setSnapshot(next.current());
const unsub = next.subscribe((s) => {
setSnapshot(s);
@@ -77,11 +91,16 @@ export function PageHeader({ provider }: PageHeaderProps) {
return () => {
unsub();
next.dispose();
+ bindingRef.current = null;
};
}, [provider]);
const icon = resolvePageIcon(snapshot.map.icon);
- const cover = resolvePageCover(snapshot.map.cover);
+ const coverKey = pickCoverKey(snapshot.map);
+ const cover = coverKey
+ ? resolvePageCover(snapshot.map[coverKey])
+ : ({ kind: 'unsupported', value: '' } as ResolvedPageCover);
+ const focalY = coverKey ? parseFocalY(snapshot.map[`${coverKey}_y`]) : null;
const hasCover = cover.kind === 'url' || cover.kind === 'path';
const hasIcon = icon.kind !== 'unsupported';
@@ -93,34 +112,160 @@ export function PageHeader({ provider }: PageHeaderProps) {
className="page-header editor-content-aligned"
data-has-cover={hasCover ? 'true' : 'false'}
data-has-icon={hasIcon ? 'true' : 'false'}
- aria-hidden="true"
data-testid="page-header"
>
- {hasCover ? <CoverBanner cover={cover} /> : null}
+ {hasCover && coverKey ? (
+ <CoverBanner
+ cover={cover}
+ focalY={focalY}
+ onCommitFocalY={(y) => {
+ const b = bindingRef.current;
+ if (!b) return;
+ const result = b.patch({ [`${coverKey}_y`]: y });
+ if (!result.ok) {
+ // Same log-and-continue posture as PropertyPanel.commitPatch:
+ // silent-drop hides malformed-YAML + region-too-large failures
+ // from the operator. The frame reverts visually because the
+ // subscribe callback won't fire; the console breadcrumb is the
+ // only signal the write was rejected.
+ console.warn('[PageHeader] focal-Y patch rejected:', result.error);
+ }
+ }}
+ />
+ ) : null}
{hasIcon ? <PageIconBlock icon={icon} hasCover={hasCover} /> : null}
</div>
);
}
-function CoverBanner({ cover }: { cover: ResolvedPageCover }) {
- // `<img>` (not CSS `background-image`) so the browser's native loader
- // shows the image, respects `loading="lazy"`, and an `onError` could
- // fall back to a placeholder later. `draggable={false}` so cover-drag
- // doesn't accidentally start a media drag-out gesture from the
- // editor.
+interface CoverBannerProps {
+ cover: ResolvedPageCover;
+ focalY: number | null;
+ onCommitFocalY: (y: number) => void;
+}
+
+function CoverBanner({ cover, focalY, onCommitFocalY }: CoverBannerProps) {
+ const { t } = useLingui();
+ // Drag state: while pointer is down we render `dragY` instead of `focalY`
+ // for live feedback; on release we commit once. Keyboard adjustment
+ // commits immediately (no drag session).
+ //
+ // The drag is DELTA-based (image moves WITH the pointer, not TO it) — a
+ // pure click would otherwise snap the focal point to wherever the pointer
+ // landed, jerking the frame on every mousedown. We store the initial
+ // client-Y + initial focal-Y at pointerdown and apply the delta on each
+ // move. dragY stays null until the first move, so a click that never moves
+ // never commits.
+ const [dragY, setDragY] = useState<number | null>(null);
+ const wrapperRef = useRef<HTMLDivElement>(null);
+ const dragStartRef = useRef<{ clientY: number; focal: number } | null>(null);
+ const displayY = dragY ?? focalY;
+ const objectPosition = focalYToObjectPosition(displayY);
+ const percent = Math.round((displayY ?? 0.5) * 100);
+
+ function onPointerDown(e: React.PointerEvent<HTMLDivElement>) {
+ // Non-primary buttons (right-click, middle-click) shouldn't drag.
+ if (e.button !== 0) return;
+ // Skip touch: a swipe across the full-width 200px banner is far more
+ // often the user trying to scroll the doc than reframe the cover.
+ // Repositioning on touch will get its own explicit affordance later.
+ if (e.pointerType === 'touch') return;
+ e.currentTarget.setPointerCapture(e.pointerId);
+ dragStartRef.current = { clientY: e.clientY, focal: focalY ?? 0.5 };
+ }
+
+ function onPointerMove(e: React.PointerEvent<HTMLDivElement>) {
+ const start = dragStartRef.current;
+ const el = wrapperRef.current;
+ if (!start || !el) return;
+ const rect = el.getBoundingClientRect();
+ if (rect.height === 0) return;
+ // Delta is inverted: `object-position` Y% counts from the TOP of the
+ // image, so dragging the pointer DOWN should DECREASE focalY (the frame
+ // scrolls up over the image → the image visibly moves down, WITH the
+ // pointer). Without the negation, drag polarity reads as scroll — image
+ // moves against the finger.
+ const delta = (start.clientY - e.clientY) / rect.height;
+ let next = start.focal + delta;
+ if (next < 0) next = 0;
+ if (next > 1) next = 1;
+ setDragY(next);
+ }
+
+ function releaseDrag(e: React.PointerEvent<HTMLDivElement>) {
+ if (!dragStartRef.current) return;
+ dragStartRef.current = null;
+ try {
+ e.currentTarget.releasePointerCapture(e.pointerId);
+ } catch {
+ // Pointer capture may have been lost already (e.g. window blur);
+ // release throws in that case and the state cleanup below is what
+ // matters.
+ }
+ const committed = dragY;
+ setDragY(null);
+ if (committed !== null && committed !== focalY) {
+ onCommitFocalY(Math.round(committed * 100) / 100);
+ }
+ }
+
+ function onKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {
+ // Arrow keys follow the WAI-ARIA slider pattern (Up/Right = increase,
+ // Down/Left = decrease). focalY is measured from the top of the image
+ // (0 = top, 1 = bottom), so ArrowUp INCREASES focalY → shows more of
+ // the image bottom. That aligns with drag: dragging up over the frame
+ // reveals more of the image bottom, same as ArrowUp.
+ const current = focalY ?? 0.5;
+ let next: number | null = null;
+ if (e.key === 'ArrowUp' || e.key === 'ArrowRight') next = Math.min(1, current + 0.05);
+ else if (e.key === 'ArrowDown' || e.key === 'ArrowLeft') next = Math.max(0, current - 0.05);
+ else if (e.key === 'Home') next = 0;
+ else if (e.key === 'End') next = 1;
+ else return;
+ e.preventDefault();
+ onCommitFocalY(Math.round(next * 100) / 100);
+ }
+
return (
<div className="page-header-cover" data-testid="page-header-cover">
- <img
- src={cover.value}
- alt=""
- draggable={false}
- loading="lazy"
- // `cover.value` can be an attacker-controlled external host
- // (`url` kind). Match `Embed` / `CodeBlockView` / `Image` —
- // never leak the doc path + query params in Referer.
- referrerPolicy="no-referrer"
- className="page-header-cover-img"
- />
+ {/* Interactive slider wraps the img; the img itself stays decorative
+ (empty alt). The slider is the only element in this region that
+ participates in the a11y tree. */}
+ <div
+ ref={wrapperRef}
+ role="slider"
+ tabIndex={0}
+ aria-label={t`Cover focal position`}
+ aria-orientation="vertical"
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-valuenow={percent}
+ aria-valuetext={t`${percent}% from top`}
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={releaseDrag}
+ onPointerCancel={releaseDrag}
+ onKeyDown={onKeyDown}
+ className="page-header-cover-slider"
+ data-testid="page-header-cover-slider"
+ data-dragging={dragY !== null || undefined}
+ >
+ {/* `<img>` (not CSS `background-image`) so the browser's native
+ loader shows the image, respects `loading="lazy"`, and an
+ `onError` could fall back to a placeholder later. */}
+ <img
+ src={cover.value}
+ alt=""
+ draggable={false}
+ loading="lazy"
+ // `cover.value` can be an attacker-controlled external host
+ // (`url` kind). Match `Embed` / `CodeBlockView` / `Image` —
+ // never leak the doc path + query params in Referer.
+ referrerPolicy="no-referrer"
+ className="page-header-cover-img"
+ style={{ objectPosition }}
+ />
+ </div>
</div>
);
}
diff --git a/packages/app/src/components/page-header-utils.test.ts b/packages/app/src/components/page-header-utils.test.ts
index 0cae99271..efa72fc1f 100644
--- a/packages/app/src/components/page-header-utils.test.ts
+++ b/packages/app/src/components/page-header-utils.test.ts
@@ -1,5 +1,11 @@
import { describe, expect, test } from 'vitest';
-import { resolvePageCover, resolvePageIcon } from './page-header-utils';
+import {
+ focalYToObjectPosition,
+ parseFocalY,
+ pickCoverKey,
+ resolvePageCover,
+ resolvePageIcon,
+} from './page-header-utils';
// ---------------------------------------------------------------------------
// resolvePageIcon
@@ -190,4 +196,154 @@ describe('resolvePageCover', () => {
test('rejects a double leading slash (network-relative URL)', () => {
expect(resolvePageCover('//evil.com/banner.png').kind).toBe('unsupported');
});
+
+ test('unwraps an Obsidian wikilink to a project asset path', () => {
+ const r = resolvePageCover('[[Attachments/pic.png]]');
+ expect(r.kind).toBe('path');
+ expect(r.value).toContain(encodeURIComponent('Attachments/pic.png'));
+ });
+
+ test('unwraps a wikilink with a display alias (drops the alias)', () => {
+ const r = resolvePageCover('[[banners/hero.jpg|Hero image]]');
+ expect(r.kind).toBe('path');
+ expect(r.value).toContain(encodeURIComponent('banners/hero.jpg'));
+ });
+
+ test('unwraps a wikilink with an anchor (drops the anchor)', () => {
+ const r = resolvePageCover('[[banners/hero.png#top]]');
+ expect(r.kind).toBe('path');
+ expect(r.value).toContain(encodeURIComponent('banners/hero.png'));
+ });
+
+ test('a non-image wikilink still rejects', () => {
+ expect(resolvePageCover('[[notes/plain-text]]').kind).toBe('unsupported');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// parseFocalY
+// ---------------------------------------------------------------------------
+
+describe('parseFocalY', () => {
+ test('accepts a plain number in range', () => {
+ expect(parseFocalY(0)).toBe(0);
+ expect(parseFocalY(0.35)).toBe(0.35);
+ expect(parseFocalY(0.5)).toBe(0.5);
+ expect(parseFocalY(1)).toBe(1);
+ });
+
+ test('accepts a numeric string', () => {
+ expect(parseFocalY('0.35')).toBe(0.35);
+ expect(parseFocalY('1')).toBe(1);
+ });
+
+ test('clamps below 0 up to 0', () => {
+ expect(parseFocalY(-0.5)).toBe(0);
+ expect(parseFocalY('-1')).toBe(0);
+ });
+
+ test('clamps above 1 down to 1', () => {
+ expect(parseFocalY(1.5)).toBe(1);
+ expect(parseFocalY('42')).toBe(1);
+ });
+
+ test('rejects non-numeric input', () => {
+ expect(parseFocalY(null)).toBeNull();
+ expect(parseFocalY(undefined)).toBeNull();
+ expect(parseFocalY('top')).toBeNull();
+ expect(parseFocalY({})).toBeNull();
+ expect(parseFocalY([])).toBeNull();
+ expect(parseFocalY(Number.NaN)).toBeNull();
+ expect(parseFocalY(Number.POSITIVE_INFINITY)).toBeNull();
+ });
+
+ test('rejects empty / whitespace-only strings (not Number("") = 0)', () => {
+ // Hand-edited `banner_y: ""` in YAML shouldn't snap the cover to the top
+ // of the frame — treat empty like non-numeric so the renderer falls back
+ // to center.
+ expect(parseFocalY('')).toBeNull();
+ expect(parseFocalY(' ')).toBeNull();
+ expect(parseFocalY('\t\n')).toBeNull();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// focalYToObjectPosition
+// ---------------------------------------------------------------------------
+
+describe('focalYToObjectPosition', () => {
+ test('null → center (fallback)', () => {
+ expect(focalYToObjectPosition(null)).toBe('center');
+ });
+
+ test('0 → top', () => {
+ expect(focalYToObjectPosition(0)).toBe('center 0%');
+ });
+
+ test('0.5 → middle', () => {
+ expect(focalYToObjectPosition(0.5)).toBe('center 50%');
+ });
+
+ test('1 → bottom', () => {
+ expect(focalYToObjectPosition(1)).toBe('center 100%');
+ });
+
+ test('rounds to nearest whole percent', () => {
+ expect(focalYToObjectPosition(0.333)).toBe('center 33%');
+ expect(focalYToObjectPosition(0.666)).toBe('center 67%');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// pickCoverKey
+// ---------------------------------------------------------------------------
+
+describe('pickCoverKey', () => {
+ test('picks banner when only banner is set', () => {
+ expect(pickCoverKey({ banner: 'https://example.com/x.png' })).toBe('banner');
+ });
+
+ test('picks cover when only cover is set', () => {
+ expect(pickCoverKey({ cover: 'https://example.com/x.png' })).toBe('cover');
+ });
+
+ test('prefers banner over cover when both resolve', () => {
+ expect(
+ pickCoverKey({
+ banner: 'https://example.com/a.png',
+ cover: 'https://example.com/b.png',
+ }),
+ ).toBe('banner');
+ });
+
+ test('falls through to cover when banner is present but not image-shaped', () => {
+ expect(pickCoverKey({ banner: 'not-an-image', cover: 'https://example.com/x.png' })).toBe(
+ 'cover',
+ );
+ });
+
+ test('falls through to cover when banner is empty string', () => {
+ expect(pickCoverKey({ banner: '', cover: 'https://example.com/x.png' })).toBe('cover');
+ });
+
+ test('falls through to cover when banner is a wikilink to a non-image', () => {
+ expect(pickCoverKey({ banner: '[[notes/plain]]', cover: 'https://example.com/x.png' })).toBe(
+ 'cover',
+ );
+ });
+
+ test('returns null when neither key resolves', () => {
+ expect(pickCoverKey({})).toBeNull();
+ expect(pickCoverKey({ banner: 'x', cover: 'y' })).toBeNull();
+ expect(pickCoverKey({ banner: null, cover: null })).toBeNull();
+ });
+
+ test('an Obsidian-shaped wikilink banner is picked over a URL cover', () => {
+ expect(
+ pickCoverKey({
+ banner: '[[Attachments/hero.png]]',
+ cover: 'https://example.com/x.png',
+ }),
+ ).toBe('banner');
+ });
});
diff --git a/packages/app/src/components/page-header-utils.ts b/packages/app/src/components/page-header-utils.ts
index c87425884..f5490937d 100644
--- a/packages/app/src/components/page-header-utils.ts
+++ b/packages/app/src/components/page-header-utils.ts
@@ -26,7 +26,12 @@
* one — keeps the storage value unambiguous across moves / renames.
*/
-import { IMAGE_EXTENSIONS, isSafeUrl, toDesktopAssetHref } from '@inkeep/open-knowledge-core';
+import {
+ IMAGE_EXTENSIONS,
+ isSafeUrl,
+ parseWikiLink,
+ toDesktopAssetHref,
+} from '@inkeep/open-knowledge-core';
/** Hard cap on raw frontmatter value length we'll classify — anything
* longer is rejected. Guards against pathological pastes that could
@@ -84,13 +89,69 @@ export interface ResolvedPageCover {
value: string;
}
+/**
+ * Which frontmatter key is authoritative for the cover render — `banner` if
+ * present and image-shaped, else `cover`. Returns null when neither key
+ * resolves. The paired focal-Y key is derived from the winner
+ * (`banner` → `banner_y`, `cover` → `cover_y`).
+ *
+ * Banner-preferred is the Obsidian-plugin convention (Pixel Banner /
+ * Obsidian Banners); cover-fallthrough covers the Notion vocabulary. When
+ * banner is present but not image-shaped (typo, unsupported extension,
+ * bare text) the classifier rejects it and cover wins.
+ */
+export function pickCoverKey(map: Record<string, unknown>): 'banner' | 'cover' | null {
+ if (resolvePageCover(map.banner).kind !== 'unsupported') return 'banner';
+ if (resolvePageCover(map.cover).kind !== 'unsupported') return 'cover';
+ return null;
+}
+
+/**
+ * Vertical focal position for the cover image, expressed as a 0.0–1.0 float
+ * (0 = align to top, 1 = align to bottom, 0.5 = center). Matches the
+ * `banner_y` convention used by the popular Obsidian banner plugins so
+ * imported vaults light up without a rename. Non-numeric input, NaN, and
+ * Infinity return null (the renderer falls back to `center`); values
+ * outside [0, 1] clamp to the nearest bound.
+ */
+export function parseFocalY(raw: unknown): number | null {
+ // Number('') and Number(' ') both coerce to 0 — treat empty-string and
+ // whitespace-only inputs the same as non-numeric (return null, renderer
+ // falls back to center). Guards against `banner_y: ""` in hand-edited
+ // YAML snapping the cover to the top of the frame instead of leaving it
+ // centered.
+ if (typeof raw === 'string' && raw.trim() === '') return null;
+ const n = typeof raw === 'number' ? raw : typeof raw === 'string' ? Number(raw) : Number.NaN;
+ if (!Number.isFinite(n)) return null;
+ if (n < 0) return 0;
+ if (n > 1) return 1;
+ return n;
+}
+
+/**
+ * Translate a parsed focal-Y into a CSS `object-position` value. Null
+ * (unset / invalid) collapses to `center` so the img falls back to the
+ * pre-focal render.
+ */
+export function focalYToObjectPosition(y: number | null): string {
+ if (y === null) return 'center';
+ return `center ${Math.round(y * 100)}%`;
+}
+
/**
* Classify a frontmatter `cover` value. Covers MUST be image-shaped — no
* emoji fallback (banner positions need a real image).
*/
export function resolvePageCover(raw: unknown): ResolvedPageCover {
if (typeof raw !== 'string') return { kind: 'unsupported', value: '' };
- const trimmed = raw.trim();
+ // Obsidian Banners-plugin vaults store local banners as wikilinks
+ // (`banner: [[Attachments/pic.png]]`) — reuse the core `parseWikiLink`
+ // parser so both wikilink and plain-path shapes route through the same
+ // image classifier. Alias / anchor components are dropped: neither is
+ // meaningful for asset resolution.
+ const rawTrim = raw.trim();
+ const wiki = parseWikiLink(rawTrim);
+ const trimmed = wiki ? wiki.target : rawTrim;
if (trimmed === '' || trimmed.length > MAX_VALUE_LENGTH) {
return { kind: 'unsupported', value: '' };
}
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index 59a8e1ddd..bd1d29638 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -5747,10 +5747,35 @@ html.electron-mode [data-slot="sidebar-inner"] {
border-bottom: 1px solid var(--border);
}
+.page-header-cover-slider {
+ /* The slider is the actual interactive layer that fills the fixed-height
+ .page-header-cover container. The img inside is sized 100% × 100% and
+ object-fit: cover clips within THIS box — without the width/height
+ here the wrapper would collapse to the img's natural aspect and
+ `object-position` would move within the natural size instead of the
+ visible chrome, so the drag would read as "phantom" (banner_y writes
+ but the visible framing never changes).
+
+ No `touch-action` override — the JS drag handler declines touch pointers
+ (see PageHeader `onPointerDown`), so vertical scroll on mobile falls
+ through as the browser default. */
+ display: block;
+ width: 100%;
+ height: 100%;
+ cursor: ns-resize;
+ outline: none;
+}
+
+.page-header-cover-slider:focus-visible {
+ box-shadow: inset 0 0 0 2px var(--ring);
+}
+
.page-header-cover-img {
width: 100%;
height: 100%;
object-fit: cover;
+ /* `object-position` is set inline from `banner_y` / `cover_y` — this is
+ the fallback for docs without a focal-position frontmatter key. */
object-position: center;
display: block;
/* Cover images aren't user-actionable today — disable native drag so
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 5403e2de2..29795b38c 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -495,6 +495,7 @@
["sanitized"],
"</0> already has files here. Pick a different name."
],
+ "7b3zu8": ["Cover focal position"],
"7bIiJ7": [
"This moves <0>",
["name"],
@@ -666,6 +667,7 @@
"AB4qw9": ["New terminal"],
"ACKMCN": ["Failed to load skill settings: ", ["0"]],
"AE7BY3": ["The terminal session ended."],
+ "AHFljV": [["percent"], "% from top"],
"AIC67-": [
"Reuse one tab when clicking through the sidebars. Off opens every click in its own tab."
],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 9047de1cd..8b21bc43c 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -638,6 +638,10 @@ msgstr "{packName} was already set up. Nothing to do."
msgid "{pageCount, plural, one {The full text of your 1 page will be sent to <0>{host}</0> as it is re-embedded.} other {The full text of all {pageCount} pages will be sent to <1>{host}</1> as they are re-embedded.}}"
msgstr "{pageCount, plural, one {The full text of your 1 page will be sent to <0>{host}</0> as it is re-embedded.} other {The full text of all {pageCount} pages will be sent to <1>{host}</1> as they are re-embedded.}}"
+#: src/components/PageHeader.tsx
+msgid "{percent}% from top"
+msgstr "{percent}% from top"
+
#: src/components/acp/ThreadView.tsx
msgid "{percent}% used ({left}% left)"
msgstr "{percent}% used ({left}% left)"
@@ -3268,6 +3272,10 @@ msgstr "Count skill installs publicly"
msgid "Counting markdown files"
msgstr "Counting markdown files"
+#: src/components/PageHeader.tsx
+msgid "Cover focal position"
+msgstr "Cover focal position"
+
#: src/components/ReportBugDialogBody.tsx
msgid "Crash dump"
msgstr "Crash dump"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 18c34b868..f3be5b026 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -495,6 +495,7 @@
["sanitized"],
"</0> àĺŕēàďŷ ĥàś ƒĩĺēś ĥēŕē. Ƥĩćķ à ďĩƒƒēŕēńţ ńàḿē."
],
+ "7b3zu8": ["Ćōvēŕ ƒōćàĺ ƥōśĩţĩōń"],
"7bIiJ7": [
"Ţĥĩś ḿōvēś <0>",
["name"],
@@ -666,6 +667,7 @@
"AB4qw9": ["Ńēŵ ţēŕḿĩńàĺ"],
"ACKMCN": ["Ƒàĩĺēď ţō ĺōàď śķĩĺĺ śēţţĩńĝś: ", ["0"]],
"AE7BY3": ["Ţĥē ţēŕḿĩńàĺ śēśśĩōń ēńďēď."],
+ "AHFljV": [["percent"], "% ƒŕōḿ ţōƥ"],
"AIC67-": [
"Ŕēũśē ōńē ţàƀ ŵĥēń ćĺĩćķĩńĝ ţĥŕōũĝĥ ţĥē śĩďēƀàŕś. Ōƒƒ ōƥēńś ēvēŕŷ ćĺĩćķ ĩń ĩţś ōŵń ţàƀ."
],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index a17692a6a..b725b3812 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -638,6 +638,10 @@ msgstr ""
msgid "{pageCount, plural, one {The full text of your 1 page will be sent to <0>{host}</0> as it is re-embedded.} other {The full text of all {pageCount} pages will be sent to <1>{host}</1> as they are re-embedded.}}"
msgstr ""
+#: src/components/PageHeader.tsx
+msgid "{percent}% from top"
+msgstr ""
+
#: src/components/acp/ThreadView.tsx
msgid "{percent}% used ({left}% left)"
msgstr ""
@@ -3264,6 +3268,10 @@ msgstr ""
msgid "Counting markdown files"
msgstr ""
+#: src/components/PageHeader.tsx
+msgid "Cover focal position"
+msgstr ""
+
#: src/components/ReportBugDialogBody.tsx
msgid "Crash dump"
msgstr ""