From 61a32bcdd5763af2005634eb15f7a02dd9df599e Mon Sep 17 00:00:00 2001
From: therealsama <263038098+therealsama@users.noreply.github.com>
Date: Sat, 28 Nov 2026 02:10:01 +0200
Subject: [PATCH] fix: hide not-found glyphs from screen readers, stop
orphaning prefetches
The not-found illustration floats a "{", a "}" and a "/" around its
drawing. The drawing is an aria-hidden SVG, but the three glyphs are
plain text, so a screen reader read "{ } /" before "Item not found" on
the 404 page, a missing item, and an unknown user or domain.
The illustration's wrapper is now aria-hidden, so every scene stays
decorative, including ones added later. axe has no rule for stray
decorative text, so the e2e scans never caught it.
Switching tabs, or going Back from a profile or domain page, mounts a
new swipe viewer, which queues the stories ahead of it again. When one
was still downloading, the queue started it a second time and replaced
its tracked AbortController, so cancelAllPrefetches() could no longer
abort the first. Thread downloads are shared, so this cost no extra
requests, but the download kept running after the cancel, outside the
three-prefetch limit. The queue now skips a story whose prefetch is
already in flight.
useSiblingComments showed a lone panel for a comment with no parent,
"a top-level comment or deleted". On Hacker News every comment has a
parent: a top-level one's is its story, which is how swiping steps
through the other top-level comments, and a deleted one keeps its
parent too. Only a story, job, poll or poll option has none, so that
branch is a fallback real comments never reach. Its comment and tests,
and the parent-link test in CommentArticle, now say so, and the tests'
no-parent item is a story. No behavior changes there.
---
src/components/CommentArticle.test.tsx | 3 ++-
src/components/StateView.test.tsx | 5 +++++
src/components/StateView.tsx | 2 +-
src/components/SwipeCommentViewer.test.tsx | 8 ++++----
src/hooks/usePrefetchItem.test.ts | 17 +++++++++++++++++
src/hooks/usePrefetchItem.ts | 2 ++
src/hooks/useSiblingComments.test.ts | 6 +++---
src/hooks/useSiblingComments.ts | 3 ++-
8 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/components/CommentArticle.test.tsx b/src/components/CommentArticle.test.tsx
index 1800420..c06adfa 100644
--- a/src/components/CommentArticle.test.tsx
+++ b/src/components/CommentArticle.test.tsx
@@ -49,7 +49,8 @@ describe('CommentArticle', () => {
});
it('omits the parent link when parentId is null', () => {
- // Top-level comments have no parent — drop the pill, don't render a dangling link.
+ // A top-level comment's parent is its story, so only an item that isn't a
+ // comment has none: drop the pill rather than render a dangling link.
renderArticle({ comment: { ...mockComment, parentId: null } });
expect(screen.queryByRole('link', { name: 'parent' })).not.toBeInTheDocument();
diff --git a/src/components/StateView.test.tsx b/src/components/StateView.test.tsx
index 0e1ca9c..65d02ff 100644
--- a/src/components/StateView.test.tsx
+++ b/src/components/StateView.test.tsx
@@ -60,6 +60,11 @@ describe('StateView', () => {
expect(heading).toBeInTheDocument();
});
+ it('hides the illustration, including its decorative glyphs, from screen readers', () => {
+ render(