learningequality / kolibri

Kolibri Learning Platform: the offline app for universal education
https://learningequality.org/kolibri/
MIT License
807 stars 677 forks source link

Search - 'Clear all' is not resetting the dropdowns #12821

Open pcenov opened 1 day ago

pcenov commented 1 day ago

@nucleogenesis I did notice one thing while testing over the weekend, and I wanted to investigate more but then the ⛈️ happened: Clear all button does clear the displayed search results and the filter applied for the search actions performed using Keywords, Categories, Activities and the Show resources options.

However, it does not clear the applied filters for any of the dropdown options (Language, Level, Channel, Accessibility). Search results are cleared, but the previously applied filter apparently stays visible, but not actually applied anymore, and the user needs to clear them manually. This can be confusing and we should force them cleared as for the other filtering options in the sidebar.

https://github.com/user-attachments/assets/0ddf0972-971d-44e4-8037-9a72ecf61788

Originally posted by @radinamatic in https://github.com/learningequality/kolibri/issues/12745#issuecomment-2457076719

pcenov commented 1 day ago

@radinamatic - opening a follow-up issue for that comment, so that we can keep track of it.

SukhvirKooner commented 1 day ago

I'd like to take on this issue. Please assign it to me.

Proposed Solution:

Extend the State Reset Logic:

I will ensure that when the 'Clear All' button is clicked, all state variables associated with the dropdown filters (Language, Level, Channel, and Accessibility) are explicitly reset to their default values (e.g., null or default options). This can be achieved by enhancing the existing state management logic, potentially in the useState .

Trigger Dropdown Re-rendering:

I will make sure to trigger a re-render for all affected dropdown components when the state is reset to guarantee that the visual state of the dropdowns reflects the cleared state. This will prevent any stale UI behavior and align with the behavior for other filters.

UI Consistency Check:

I plan to introduce a unit test or an automated UI test to verify that when the 'Clear All' button is pressed, all dropdowns are effectively reset, alongside any search results or other filters, maintaining a consistent user experience.

MisRob commented 16 hours ago

Hi @SukhvirKooner, thanks for volunteering! This issue is not open for contribution.

There are contributing opportunities in three repositories. See the contributing guidelines including links to issues suitable for contribution for each repository here:

You can also see the list of unassigned "help wanted" or "good first issue" issues across all repositories.