feat(404): branded leaf-fall custom 404 page + dark 500 fallback (#1190)#1359
Merged
Conversation
Add custom error pages wired via root-URLconf handler404/handler500. - 404: the page loads fully assembled (a full-window grid of triangles with the Makeability Lab logo embedded), then the background grid flutters down like falling leaves and settles into a pile, leaving the logo standing (makelab-404.js, MakeabilityLabLogoLeafFall from the pinned js@0.6.0 dist). Click / press R to replay. The logo's L overlay is set semi-translucent via the lib's setLTriangleFillColor. Honors prefers-reduced-motion (static settled state). Recovery content -- big "404 / PAGE NOT FOUND" heading above the logo, supportive text + nav links below -- lives in the DOM, with a tight black highlight per line for legibility over the grid. - Responsive logo placement: the logo (and its grid) shrinks and is lifted by a continuous, width-based amount so it stays well-placed from desktop down to narrow phones (no breakpoint jump). - 500: static dark fallback with the colored logo (no JS/CDN dependency). - Dev-only /404-preview/ and /500-preview/ routes (registered only when DEBUG=True) so the pages can be viewed locally with static files intact, avoiding the DEBUG=False/static-serving pitfall of earlier attempts. - Regression tests: 404 status, custom template, nav links present, requested-path HTML-escaping (reflected-XSS guard), preview route absent when not DEBUG. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1190.
What this adds
A branded, animated 404 page (plus a matching dark 500 fallback), wired through Django's root-URLconf error handlers.
404 — "leaf fall"
The page loads fully assembled (a full-window grid of triangles with the Makeability Lab logo embedded), then the background grid flutters down like falling leaves and settles into a pile, leaving the logo standing. Click anywhere or press R to replay.
MakeabilityLabLogoLeafFallfrom the pinned CDN distmakeabilitylab/js@0.6.0(startAssembled→dropLeaves()).setLTriangleFillColor(added in 0.6.0).404 / PAGE NOT FOUNDheading, supportive text, and<nav>links — not canvas text. The canvas is decorative (role="img"+aria-label). Honorsprefers-reduced-motion(renders the static settled state, drops "Animated" from the label). Each text line gets a tight black highlight for legibility over the grid.500
Static, dark fallback with the colored logo — no JS/CDN dependency (a 500 means something already broke).
Implementation notes
handler404/handler500declared in the root URLconf (makeabilitylab/urls.py); views inwebsite/views/custom_404.py./404-preview/and/500-preview/routes, registered only whenDEBUG=True, so the pages can be viewed locally with static files intact — sidestepping theDEBUG=False/static-serving pitfall that derailed earlier attempts (no globalDEBUGflip, no WhiteNoise, no--insecure).Testing
website/tests/test_custom_404.py(5 tests): 404 status, custom template used, recovery nav links present, requested-path HTML-escaping (reflected-XSS guard), and preview route absent when notDEBUG.python manage.py test website --settings=makeabilitylab.settings_test.Screenshots
404BrokenGlassMakeabilityLab.mov
Notes / follow-ups
DEBUG=False; only 404s for missing/static/&/media/files (served directly by Apache) would need anErrorDocument 404from UW CSE IT. Not a blocker..pa11yci.jsonsince the preview route is dev-only).🤖 Generated with Claude Code