Skip to content

fix: hide not-found glyphs from screen readers and stop orphaning in-flight prefetches - #355

Merged
therealsama merged 1 commit into
mainfrom
fix/not-found-glyphs-and-orphaned-prefetch
Nov 28, 2026
Merged

therealsama merged 1 commit into
mainfrom
fix/not-found-glyphs-and-orphaned-prefetch

Conversation

@therealsama

@therealsama therealsama commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Two bug fixes from an audit, each with a regression test that fails without the fix, and a corrected code comment.

What changed

  • Not-found pages no longer read "{ } /" to screen readers. The illustration's floating {, } and / were plain text, so they were read before the "Item not found" heading. StateView now marks the illustration aria-hidden.
  • A remounted swipe viewer no longer orphans prefetches. Switching tabs or going Back re-queued stories that were still downloading, and the queue restarted them with a new AbortController. cancelAllPrefetches() then lost track of the first download, which kept running past the three-prefetch limit. processQueue now skips a story that's already in flight.
  • A misleading comment is corrected. useSiblingComments said top-level and deleted comments have no parent. On HN every comment has one; only stories, jobs, polls and poll options don't (checked against the live API). The comment and the matching test names and fixtures now say so. No behavior change.

Testing

  • npm run typecheck: passed
  • npm run lint: passed
  • npm run test:run: passed, 1035 tests
  • npm run build: passed
  • npm run e2e -- --project=chromium --project="Mobile Chrome": 415 passed, 9 skipped (same as main)

Build and e2e ran before the final comment and test-data edits.

…ches

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.
@therealsama
therealsama force-pushed the fix/not-found-glyphs-and-orphaned-prefetch branch from 14575ea to 61a32bc Compare November 28, 2026 00:10
@therealsama
therealsama merged commit e960841 into main Nov 28, 2026
4 checks passed
@therealsama
therealsama deleted the fix/not-found-glyphs-and-orphaned-prefetch branch November 28, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants