-
Notifications
You must be signed in to change notification settings - Fork 33
feat: add collapsible checkbox filters #2097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Hey there - I've reviewed your changes - here's some feedback:
- The
.collapsible-filter-wrapperstyles are duplicated between datasets and proposal filters; consider extracting these into a shared stylesheet or mixin to keep styling consistent and easier to maintain. - The checkbox-specific template logic (wrapper div, toggle button, and expandedFilters handling) is very similar between datasets and proposals; you could reduce duplication by introducing a reusable component/directive or helper that encapsulates the collapsible behavior.
- Relying on
::ng-deepanddisplay: none !importantto hide parts ofshared-filteris brittle; if possible, expose an input or CSS hook onshared-filterto control its collapsed state instead of reaching into its internals.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `.collapsible-filter-wrapper` styles are duplicated between datasets and proposal filters; consider extracting these into a shared stylesheet or mixin to keep styling consistent and easier to maintain.
- The checkbox-specific template logic (wrapper div, toggle button, and expandedFilters handling) is very similar between datasets and proposals; you could reduce duplication by introducing a reusable component/directive or helper that encapsulates the collapsible behavior.
- Relying on `::ng-deep` and `display: none !important` to hide parts of `shared-filter` is brittle; if possible, expose an input or CSS hook on `shared-filter` to control its collapsed state instead of reaching into its internals.
## Individual Comments
### Comment 1
<location> `src/app/datasets/datasets-filter/datasets-filter.component.html:38-42` </location>
<code_context>
+ (checkBoxChange)="setFilter(filter.key, $event)"
+ (numericRangeChange)="numericRangeChange(filter.key, $event)"
+ ></shared-filter>
+ <button class="collapse-toggle" (click)="toggleFilter(filter.key)">
+ <mat-icon>{{
+ expandedFilters[filter.key] ? "expand_less" : "expand_more"
+ }}</mat-icon>
+ </button>
+ </div>
+
</code_context>
<issue_to_address>
**suggestion:** Enhance accessibility for the collapse toggle button with ARIA attributes.
This button only reflects its state visually. Please bind `aria-expanded` to `expandedFilters[filter.key]`, and consider adding `aria-label` and `aria-controls` pointing to the associated filter content so assistive technologies can correctly interpret the control’s state and purpose.
Suggested implementation:
```
></shared-filter>
<button
class="collapse-toggle"
(click)="toggleFilter(filter.key)"
[attr.aria-expanded]="expandedFilters[filter.key]"
[attr.aria-controls]="'filter-panel-' + filter.key"
[attr.aria-label]="'Toggle filter ' + filter.label"
>
<mat-icon>{{
expandedFilters[filter.key] ? "expand_less" : "expand_more"
}}</mat-icon>
</button>
</div>
```
```
<div
*ngIf="filter.type === 'checkbox' && filter.enabled"
class="collapsible-filter-wrapper"
[class.collapsed]="!expandedFilters[filter.key]"
[attr.id]="'filter-panel-' + filter.key"
>
<shared-filter
[key]="filter.key"
[label]="filter.label"
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
One question here, should user know collapsed field can contain applied filters? |
Good point! It will best for users to know if it has active filters on a collapsed field. I can add something that would indicate it |
…ct/frontend into collapsible_checkbox_filters
…ct/frontend into collapsible_checkbox_filters

Description
Added collapse/expand functionality to checkbox filters on both dataset and proposal pages.
Motivation
Fixes:
Please provide a list of the fixes implemented in this PR
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Add collapsible checkbox filters to dataset and proposal listing pages and cover the behaviour with end-to-end tests.
New Features:
Enhancements:
Tests: