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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Presentation-layer note:
### Article preview

- when enabled in Reader settings, clicking any card (including its title) loads a reader view in a right-hand panel instead of opening a new tab
- while the preview request is in flight, the panel keeps the card title and shows a preview skeleton after a short delay; the loaded title and content fade in, and a failed request replaces the skeleton with a readable error message
- while the preview request is in flight, the panel keeps the card title until the delayed skeleton appears; the skeleton then replaces the provisional title and mimics the article title/byline/body rhythm, and the fetched title and content fade in. A failed request clears the skeleton, restores the card title, and shows a readable error message
- transient upstream `429`/`5xx` responses are retried once with jitter; blocked sources, timeouts, unsupported formats, and failed fetches get specific messages
- the visible loading message is visually hidden while the skeleton is shown; the panel remains `aria-busy` and a live region announces the loading state
- `Cmd`/`Ctrl`/`Shift`-clicking a title still opens the article in a new tab
Expand Down
2 changes: 1 addition & 1 deletion core/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function renderIndexPage(data: PageData): string {
<link rel="apple-touch-icon" href="/apple-touch-icon.png?v=8" />
<script>${data.themeInitScript}</script>
<style>${data.inlineCss}</style>
<script src="/static/app.js?v=110" defer></script>
<script src="/static/app.js?v=111" defer></script>
</head>
<body data-app-version="${escapeHtml(data.appVersion)}">
<div class="boot-veil" data-boot-veil aria-hidden="true">
Expand Down
2 changes: 1 addition & 1 deletion core/test/render.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("renderIndexPage", () => {
expect(html).toContain(
"<script>document.documentElement.dataset.theme='dark';</script>",
);
expect(html).toContain('/static/app.js?v=110');
expect(html).toContain('/static/app.js?v=111');
expect(html).not.toContain("style.css");
expect(html).not.toContain("theme-init.js");
});
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Browser-only preferences and reading state live in `localStorage`: theme prefere

- The inline pre-paint theme script also records `display-mode: standalone` (and iOS `navigator.standalone`) as `data-standalone`. The server renders a lightweight boot veil; CSS only displays it in an installed app, and `app.js` fades and removes it after the first content frame. Browser tabs never see it, so it does not affect LCP.
- Client-side feed loads use skeleton cards. A 150 ms delay avoids flashing placeholders on fast responses when a feed is already on screen (an empty grid shows them immediately); replace loads snapshot the current grid so a failed request can restore it, and append loads add three skeleton rows at the bottom.
- The reader preview uses the same delayed-skeleton idea: the card title stays visible, a preview skeleton replaces the visible loading message after 150 ms, and the loaded title/content fade in. Aborts and failures clear the skeleton and restore the readable status message. A transient `503` from the preview endpoint is retried once after 500 ms; `429`s are not retried because the limiter's `Retry-After` is 60 seconds.
- The reader preview uses the same delayed-skeleton idea: the provisional card title stays visible for the first 150 ms, then the skeleton hides it and starts with a title placeholder followed by byline/body rhythm; the fetched title and content fade in. Aborts and failures clear the skeleton, restore the card title, and show the readable status message. A transient `503` from the preview endpoint is retried once after 500 ms; `429`s are not retried because the limiter's `Retry-After` is 60 seconds.
- Skeleton cards are `aria-hidden`; the grid sets `aria-busy`, and a visually hidden live region carries the loading message.
- Completed replace loads crossfade through the View Transitions API when available, with a Web Animations fade fallback. `prefers-reduced-motion: reduce` disables shimmer and both transition paths.
- The search field hides the browser's native `type="search"` clear control; the app's search toggle/close button is the only clear affordance.
Expand Down
2 changes: 1 addition & 1 deletion docs/RUNBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Before considering any `core/render.ts` change done:
- the response carries `Cache-Control: private, no-store` (the five-minute edge copy lives in the Cache API and is rewritten to this header on the way out)
- in a regular browser tab the launch veil stays hidden (`display: none`) and is removed from the DOM; in an installed/standalone window it is visible and fades out within about a second
- throttle the network, then change a source filter or run a search: skeleton cards appear after ~150 ms and are replaced by the new cards; `View more` appends three skeleton rows
- enable article preview, throttle the network, and open a card: the card title stays visible while a preview skeleton appears in the panel, then the fetched title/content fade in; a failed preview clears the skeleton and shows the error status
- enable article preview, throttle the network, and open a card: after ~150 ms the provisional card title is replaced by the preview skeleton (title, byline, and body placeholders), then the fetched title/content fade in; a failed preview clears the skeleton, restores the card title, and shows the error status
- with `prefers-reduced-motion: reduce`, skeleton shimmer and the view/Web Animations transitions are disabled
- typing in the search box shows only the app's close control, not a second native clear X
- header actions render correctly
Expand Down
4 changes: 2 additions & 2 deletions web-static/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const SHELL_CACHE = "reader-shell-v144";
const SHELL_CACHE = "reader-shell-v145";
const ITEMS_CACHE = "reader-items-v24";
const CORE_ASSETS = [
"/",
"/static/app.js?v=110",
"/static/app.js?v=111",
"/static/source-icons/hackernews.svg",
"/static/source-icons/github.svg",
"/static/source-icons/huggingface.svg",
Expand Down
13 changes: 12 additions & 1 deletion web-static/static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@

const previewSkeletonMarkup = `
<div class="preview-skeleton" data-preview-skeleton aria-hidden="true">
<span class="skeleton-line skeleton-line--preview-heading"></span>
<div class="preview-skeleton-meta">
<span class="skeleton-line skeleton-line--preview-meta"></span>
<span class="skeleton-line skeleton-line--preview-meta-short"></span>
</div>
<span class="skeleton-line skeleton-line--preview-heading"></span>
<span class="skeleton-line skeleton-line--preview-body"></span>
<span class="skeleton-line skeleton-line--preview-body"></span>
<span class="skeleton-line skeleton-line--preview-body-short"></span>
Expand Down Expand Up @@ -1392,6 +1392,12 @@
});
};

// The provisional card title is hidden only once the delayed skeleton
// appears, so a fast response still swaps straight to the fetched title.
const setPreviewTitleLoading = (loading) => {
previewTitle?.classList.toggle("is-preview-loading", loading);
};

const animatePreviewContent = () => {
if (!previewContent || reducedMotionMedia?.matches === true) return;
if (typeof previewContent.animate !== "function") return;
Expand All @@ -1414,6 +1420,7 @@
const showPreviewSkeleton = (requestId) => {
previewSkeletonTimer = null;
if (requestId !== previewRequestSequence || !previewContent) return;
setPreviewTitleLoading(true);
previewContent.innerHTML = previewSkeletonMarkup;
};

Expand Down Expand Up @@ -2199,6 +2206,7 @@
}
if (previewTitle) {
previewTitle.textContent = "Article preview";
previewTitle.classList.remove("is-preview-loading");
}
if (previewMenuOpenLink) {
previewMenuOpenLink.href = "#";
Expand Down Expand Up @@ -2308,6 +2316,7 @@
syncPreviewChromeHeights();
setPreviewCommentsLink(commentsUrl);
setPreviewTitle(title);
setPreviewTitleLoading(false);
if (previewByline) {
previewByline.textContent = "";
previewByline.classList.add("is-hidden");
Expand Down Expand Up @@ -2354,6 +2363,7 @@
? payload.title
: title;
setPreviewTitle(nextTitle);
setPreviewTitleLoading(false);
const bylineParts = [payload.byline, payload.site_name].filter(
(value) => typeof value === "string" && value.trim() !== "",
);
Expand Down Expand Up @@ -2401,6 +2411,7 @@
previewContent?.replaceChildren();
previewByline?.classList.add("is-hidden");
previewReadingMeta?.classList.add("is-hidden");
setPreviewTitleLoading(false);
const reason =
typeof error?.previewReason === "string" ? error.previewReason : "";
const message =
Expand Down
9 changes: 7 additions & 2 deletions web-static/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2115,8 +2115,13 @@ body.is-dialog-open {
height: 0.52rem;
}

/* Reader-panel skeleton: the card title stays visible, so the placeholder
starts at the byline/meta line and mirrors the article block rhythm. */
/* Reader-panel skeleton: the provisional card title is hidden when this
appears, so the placeholder starts with a title line and mirrors the
article block rhythm. */
.preview-panel-title.is-preview-loading {
display: none;
}

.preview-skeleton {
display: flex;
flex-direction: column;
Expand Down
Loading