Skip to content

refactor: hide-resolved state, persist filter, restore switch CSS#368

Merged
tomasz-tomczyk merged 3 commits intomainfrom
audit/frontend-fixes
Apr 26, 2026
Merged

refactor: hide-resolved state, persist filter, restore switch CSS#368
tomasz-tomczyk merged 3 commits intomainfrom
audit/frontend-fixes

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

Release audit follow-up addressing frontend findings from v0.10.0..HEAD review.

Fixes:

  • Restore .comments-panel-switch CSS rules (deleted but still emitted by JS — broken styling)
  • disconnected-banner top now responsive via --crit-header-height + ResizeObserver (was inline-style + stale on resize)
  • Idempotency guard in showDisconnected (no double banner)
  • type="button" on filter / toggle / settings pills (avoid implicit form submit)

Refactors:

  • Single source of truth for crit-hide-resolved (isHideResolved / setHideResolved accessors; replaces 4 direct localStorage reads)
  • Persist commentsActiveFilter via localStorage (crit-comments-filter)
  • Replace applyHideResolved DOM walk with body.hide-resolved body class + :has() CSS rule
  • Inline tokenize helper (orphaned after diff-match-patch swap)
  • Extract getAllCommentCards() helper

A11y:

  • Chevron aria-hidden="true" (decorative)
  • Expand-all aria-pressed reflects state

Review

  • Code review: passed (frontend-expert agent — verdict: ship)
  • User visual sanity check: lgtm

Test plan

  • Toggle hide-resolved in settings — verify resolved comments hide/show
  • Switch comments panel filter, reload — verify selection persists
  • Trigger disconnect, resize window — verify banner stays under header

🤖 Generated with Claude Code

@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.16%. Comparing base (15309c5) to head (7b347da).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
+ Coverage   67.10%   67.16%   +0.05%     
==========================================
  Files          18       18              
  Lines        7823     7823              
==========================================
+ Hits         5250     5254       +4     
+ Misses       2181     2178       -3     
+ Partials      392      391       -1     
Flag Coverage Δ
e2e 35.03% <ø> (+0.16%) ⬆️
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 3 commits April 26, 2026 20:51
…itch CSS

- Restore .comments-panel-switch CSS rules (deleted but still emitted)
- Single source of truth for crit-hide-resolved (isHideResolved/setHideResolved)
- Persist commentsActiveFilter via localStorage (crit-comments-filter)
- Replace applyHideResolved DOM walk with body.hide-resolved + :has() CSS
- Make disconnected-banner top responsive via --crit-header-height + ResizeObserver
- Add type="button" to filter / toggle / settings pills
- Idempotency guard in showDisconnected
- Inline tokenize helper (orphaned after diff-match-patch swap)
- Extract getAllCommentCards() helper
- ARIA: chevron aria-hidden, expand-all aria-pressed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- localStorage is scoped per origin (incl. port); crit defaults to
  random port so settings reset every invocation. Cookies are host-scoped
  and survive port changes — match the pattern used by crit-width,
  crit-theme, crit-diff-mode, crit-toc, etc.
- Replace #fff with var(--crit-fg-on-brand) in switch-thumb (stylelint)
- Add --crit-header-height to check-css-vars allowlist (set via JS)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Filter is a transient view, not a preference. Persisting it would mean
coming back to a new review with "resolved only" still active and missing
new open comments. Hide-resolved is sticky-by-design (a permanent
"never show me resolved" preference); the segmented filter is contextual.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit 5597117 into main Apr 26, 2026
3 of 4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the audit/frontend-fixes branch April 26, 2026 19:52
tomasz-tomczyk added a commit that referenced this pull request Apr 26, 2026
#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 added a commit that referenced this pull request Apr 26, 2026
…#369)

* refactor: convert comments-panel filter to radiogroup with keyboard nav

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>

* chore: fix no-useless-assignment lint

* test: hide-resolved persists in cookie not localStorage

#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>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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