-
Notifications
You must be signed in to change notification settings - Fork 0
feat: #132 a11y/theme/UX polish, #133 hero LCP & Apache headers, and #135 final docs/screenshots #140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. This is a big PR, but each part is easy to follow and the tests cover it well. I only looked at what this PR changes on top of #138.
About the #138 review
document.title: fixed. Discover, Album and Crate now set the title, including the loading and error states.- Focus on route change: not fixed. Focus still falls to
<body>when the card link unmounts, and screen readers don't announce anything. It's fine to fix it in #138 or here, but one of them needs to do it before both are merged. - Error boundary for stale chunks: not part of this PR, still open on #138.
Looks good
- Theme toggle: a static "Dark mode" label with
aria-pressedis the right pattern, because the name doesn't change when the state does. Thedata-themeselectors and the:root:not([data-theme=…])media queries cover both directions, andtry/catcharoundlocalStoragematchesuserIdentity. - Anti-FOUC:
%BASE_URL%theme-init.jsbecomes/project2/theme-init.js, and files inpublic/are copied to the root ofdist, so the path works on the VM. The script runs synchronously in<head>before first paint, and it is an external file, so it would also work underscript-src 'self'. Note that the repo doesn't set a CSP anywhere yet, so the "CSP-safe" part is future-proofing for now. - Light-mode contrast: I checked the new colors.
--dangeron surface/bg/raised is 6.3–7.3:1,--mutedis 5.6:1 or higher,--chip-textis 6.4:1, and the toggle border on the header is 4.3:1. They all pass AA. - 44px targets: buttons, the compact CrateButton, filter chips, nav links and the new artist and genre links are all at least
2.75rem. - CrateButton: "Add to crate: <title>" starts with the visible text, so
label-content-name-mismatchpasses, and each card now has a unique name. - Delete confirmation: focus moves to Cancel when it opens and back to "Delete review" on Cancel or Escape. On success, focus goes to the status message.
- Error messages: the allowlist matches the server's real messages (
Rating must be…,Comment must be…,Album not found.,Review not found for this user.), and everything else falls back to the generic text.
Non-blocking
aria-invalidon the<fieldset>. In ARIA 1.2,aria-invalidisn't supported on thegrouprole, so most screen readers ignore it there.role="radiogroup"on the fieldset (oraria-invalidon the radios) would fix that. Moving focus to the first star together with therole="alert"already covers the important part.- The comment is marked invalid for every non-rating error.
commentHasErroriserror && !ratingError, so a network error or "Album not found." also setsaria-invalidon the textarea. I would only set it when the message starts with "Comment must be". - Escape is caught on
window. While the confirmation is open, pressing Escape anywhere, even inside the textarea, cancels it and moves focus. AnonKeyDownon the confirmation group would limit it to the group. - Focus after a failed refresh. If the delete works but
onChanged()fails, the confirmation unmounts and focus falls to<body>. Moving focus to the "Try again" button would fix that. - No confirmation when adding to the crate. Without
aria-pressed, the only feedback is the name changing on the focused button, and many screen readers don't announce that. A visually hiddenrole="status"saying "Added <title> to your crate" would make it clear. - No way back to "follow system". After the first click, the stored theme is used forever. That's fine for now, but worth knowing.
- Duplicated theme blocks. The dark variables are written twice in
global.css, and the light card and detail rules are written twice inAlbumCard.cssandAlbumDetailPage.css. They will drift apart easily. A short comment saying "keep in sync" would help.
#137 E2E impact
The impact is smaller than the description says. #137's tests don't use any CrateButton or aria-pressed locators, so removing those doesn't break anything. Only the new "validates, publishes, edits, and cleans up a review" test needs Confirm delete added after its two Delete review clicks. search.spec.ts will also get a small merge conflict on the same two lines in the first test, since both PRs change them.
|
Thanks for the detailed review, @evenkkl! Rebased onto the updated
Added unit tests covering each item and verified locally with |
f9925a6 to
87269e0
Compare
…d VM hardening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good. I checked 87269e0 and the rebase.
- Rebase: clean.
git range-diffshows6bba797matches the oldf9925a6, except thatThemeTogglenow sits next toRouteErrorBoundaryinApp.tsx. Nothing else changed. #138 now also handles focus on route change and the error boundary, so everything from the first review is covered. role="radiogroup": done, and the tests find it by its accessible name "Rating".commentHasError: done. Server "Rating must be…" errors now mark the rating group too, which is a good addition.- Escape: handled on the two confirmation buttons now, so Escape in the textarea no longer does anything.
- Focus after a failed refresh: moves to "Retry album refresh". The effect checks for that before it focuses the status message, so the two don't compete.
- Crate announcement: done.
- Sync comments: added to all three files.
One small non-blocking thing: the role="status" span in CrateButton only renders once there is a message. Some screen readers, VoiceOver in particular, don't announce a live region that is added together with its text. If you render the span all the time and only change its text, it gets announced reliably. This can be a follow-up.
|
@evenkkl Already-approved Full local validation ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving. I checked the merges:
- Merges: the #141 head (
9326b6d) and the #142 head (ea155ef) are the exact commits that were approved.git show --remerge-diffshows no changes in either merge apart from the automatic result. So nothing new was added and nothing was lost. - Merge with main:
README.mdwas the only conflict, and it is resolved correctly. It keeps #139'sunaccentwording, drops the old "not accent-insensitive" line, and uses #142'smusicBrainzArtistIdnote instead of the old "matched by name" line. The note matchesmusicBrainzCatalog.ts. - CI on
77371f1: format/lint/typecheck/test/build and the PostgreSQL integration tests pass. Deploy is skipped, as it should be on a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. The updated PR includes the accessibility and UX improvements, hero image and Apache header changes, and the final documentation updates. The earlier review feedback has been addressed, and the latest format, lint, typecheck, test, build, and PostgreSQL integration checks are passing.
Closes #132
Closes #133
Closes #135
This PR combines the already-approved Track B stack (
#142→#141→#140) and merges the latestmain(including#138/#131and#139/#130) so a single approval lands all three issues cleanly.Included PRs & Summary
1.
#132— Accessibility fixes, CSP-safe manual theme toggle, and UI/UX polish (#140)document.title(WCAG 2.4.2): Updated per route, active search query, album title, loading, and error states (DiscoveryPage.tsx,AlbumDetailPage.tsx,CratePage.tsx).CrateButtonaccessible names without double-state announcement (CrateButton.tsx,AlbumCard.tsx,AlbumDetailPage.tsx): Album-specific action labels (Add to crate: <title>/Remove from crate: <title>) withoutaria-pressed.ReviewFormerror a11y, friendly errors & delete confirmation (ReviewForm.tsx,ReviewForm.css,AlbumDetailPage.tsx,e2e/tests/search.spec.ts): Linked errors viaid="review-form-error",aria-invalid, andaria-describedby, focused 1-star radio on invalid submit, sanitized unexpected exceptions, and added inline two-step delete confirmation (Delete review→Confirm delete/Cancel,Escapecancels and restores focus).ThemeToggle.tsx,useTheme.ts,client/public/theme-init.js,client/index.html): HeaderDark modetoggle (aria-pressed) defaulting to OSprefers-color-scheme, persisted safely inlocalStorage, with external 298 B/project2/theme-init.js(zerounsafe-inline).2.75rem),CratePage&SearchFormfixes, and UX polish: Raised interactive targets to>= 2.75rem, restored focus onCratePageremoval and finalLoad more, guardedSearchFormEscapecapture, added client-side recent-search filtering, switched cover framing toobject-fit: cover, and made artist/genre tags onAlbumDetailPageclickable<Link>s.2.
#133— Hero image/mobile LCP optimization and Apache headers (#141, already approved & merged into this branch)vinyl-hero.webp(1280×720, 39,164 B, -91.3%) and mobilevinyl-hero-mobile.webp(640×360, 13,394 B, -97.0%).<picture>hero & tighter mobile layout: Replaced CSS::beforebackground with eagerfetchPriority="high"<picture>, tightened mobile hero spacing, and added a mobile"Browse catalog"jump link to#catalogue.docs/VM-setup.md): AddedreferrerPolicy="no-referrer"+<meta name="referrer" content="no-referrer" />, and documentedmod_deflate,Cache-Control, baseline security headers (CSP,X-Frame-Options,X-Content-Type-Options,Referrer-Policy),NODE_ENV=production, and verification/rollback steps.3.
#135— Final documentation sync, AI reflection, Lighthouse/a11y log, and screenshots (#142, already approved & merged into this branch)docs/AI-USAGE.md,README.md): Model versions, 2 concrete prompt-to-revision examples, benefits/risks/limits reflection, log defect fixes, and rows for#74and#129–#135.docs/lighthouse-results.md,docs/architecture.md,docs/ui-specification.md,README.md): 12 local production-preview Lighthouse runs,@axe-core/playwrightWCAG 2.1 A/AA checks (0 violations across 10 states), 200%/400% zoom & 320 px reflow checks (0 px overflow), and exact production asset sizes.docs/images/*.png).What was tested (post-merge with
main)pnpm install --frozen-lockfile && pnpm codegen && pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build— all passed cleanly (client/src/generatedclean, 0 lint warnings).index-Bx0quCjo.jsat395,383 B(<= 512,000 BCI budget).