Skip to content

refactor: port hook lifecycle and a11y fixes from crit-web for parity#369

Merged
tomasz-tomczyk merged 3 commits intomainfrom
audit/parity-port-js-fixes
Apr 26, 2026
Merged

refactor: port hook lifecycle and a11y fixes from crit-web for parity#369
tomasz-tomczyk merged 3 commits intomainfrom
audit/parity-port-js-fixes

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

Parity port from crit-web's release audit (crit-web#129). Three fixes were identified there; only one ports cleanly to crit:

Applied — comments-panel filter pill a11y

  • frontend/index.html: role="radiogroup" parent; each button is role="radio" + aria-checked + roving tabindex (replaces aria-pressed).
  • frontend/app.js: ArrowLeft/Right/Up/Down (wrap), Home/End keyboard navigation. Click + keyboard route through shared activateFilterBtn helper. Re-render path keeps aria-checked / tabindex in sync.

Skipped — lifecycle fixes (don't apply here)

  • Panel idempotency guard: in crit-web the comments panel is created in JS inside a LiveView hook's mounted(), so duplicate-mount and stale-orphan races are real. Here, the panel is static markup in frontend/index.html (lines 129-151). No creation-on-mount path → no fix needed.
  • trackedSetTimeout cleanup: crit's frontend is a top-level IIFE loaded once. There is no destroy/teardown phase; pending timers naturally die with the document on full navigation. Adding the helper without a destroyed callsite would be dead code.

The fourth audit fix (crit-hide-resolved cache) already shipped via #368.

Test plan

  • node --check frontend/app.js — clean
  • Tab into the segmented filter pill: ArrowLeft/Right/Home/End move focus + activate
  • Screen reader announces "All, radio button, 1 of 3, checked" instead of "All, button, pressed"

🤖 Generated with Claude Code

Ports the a11y fix from crit-web for review-page parity. Replaces the
group/aria-pressed pattern with the standard radiogroup semantics:

- role="radiogroup" parent; role="radio" + aria-checked + roving
  tabindex on each filter button
- ArrowLeft/Right/Up/Down (wrap), Home/End keyboard navigation
- Click + keyboard route through shared activateFilterBtn helper

Two other crit-web fixes (panel-creation idempotency, trackedSetTimeout
cleanup) don't apply here — crit's frontend is a single-load IIFE with
static panel markup and no destroy phase, so the underlying remount /
teardown races those fixes address don't exist on this side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.12%. Comparing base (2f24bb2) to head (2cda3c4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
+ Coverage   67.10%   67.12%   +0.01%     
==========================================
  Files          18       18              
  Lines        7823     7823              
==========================================
+ Hits         5250     5251       +1     
+ Misses       2181     2180       -1     
  Partials      392      392              
Flag Coverage Δ
e2e 34.87% <ø> (-0.13%) ⬇️
unit 62.95% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

tomasz-tomczyk and others added 2 commits April 26, 2026 21:04
#368 migrated crit-hide-resolved from localStorage to a host-scoped
cookie (port-stable across crit invocations). Test still asserted the
old localStorage value and failed on every run since.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit 483752c into main Apr 26, 2026
6 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the audit/parity-port-js-fixes branch April 26, 2026 21:22
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.

1 participant