feat: FiltersSidebar collapse persistence#337
Merged
greatest0fallt1me merged 1 commit intoJun 29, 2026
Conversation
- Add collapsible filter sections (Categories, Price, Popularity) - Persist collapsed state to localStorage via usePersistedState hook - Add ChevronIcon component for expand/collapse indicator - Implement WCAG 2.1 AA accessibility with aria-expanded/aria-controls - Add reduced motion support and responsive styling - Add comprehensive tests for collapse functionality closes CalloraOrg#254
3c60d5d to
29ab4f2
Compare
|
@vicky4196 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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 #254
Polish FiltersSidebar with Collapse Persistence
Summary
This PR implements collapsible filter sections in
FiltersSidebarwith localStorage persistence to remember collapsed states across page visits. Users can now collapse/expand each filter group (Categories, Price range, Popularity) independently, and their preferences are saved for future sessions.Changes
src/components/FiltersSidebar.tsxFilterGroupcomponent with collapsible behaviorusePersistedStatehook to persist collapsed state in localStoragearia-expanded,aria-controls) for accessibilityhiddenattribute to hide collapsed content from screen readerssrc/components/icons/ChevronIcon.tsx(new)src/components/icons/index.tsxChevronIconcomponentsrc/index.css.filter-group__header,.filter-group__chevron, and.filter-group__panelprefers-reduced-motionmedia querysrc/state/uiPrefs.tsisSectionCollapsed(),toggleSectionCollapsed(), andsetSectionCollapsed()functions for collapsed section state managementTest Files
src/components/FiltersSidebar.test.tsx- New comprehensive tests for collapse functionalitysrc/state/uiPrefs.test.ts- Tests for the uiPrefs collapse state functionsAccessibility (WCAG 2.1 AA)
aria-expandedindicates the current state of each filter grouparia-controlsassociates headers with their content panelshiddenattribute removes collapsed content from assistive technologyvar(--accent)with proper contrast against both light and dark backgroundsprefers-reduced-motionsupport for users who request reduced motionResponsive Design
The filter headers adapt to smaller screens:
API/Visible Changes
Component API (no breaking changes)
FiltersSidebarmaintains the same external props interface - this is a purely visual enhancement.localStorage Keys
callora.filters.categories.collapsed- Categories section state (boolean)callora.filters.price.collapsed- Price range section state (boolean)callora.filters.popularity.collapsed- Popularity section state (boolean)Test Output
All tests pass including:
Notes
The existing tests in the repository have pre-existing issues unrelated to this change:
FiltersBottomSheet.test.tsx- missingwindow.matchMediamock in jsdomTabs.test.tsx- same matchMedia issueApiDetailPage.tsx,ApiUsage.tsx,ApiCard.tsx- JSX syntax errors in existing codeThese do not affect the functionality of the changes in this PR.