Soft limits are incompatible with a hierarchical (collapsible) facet tree

Created on 13 April 2021, over 3 years ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

Facets soft limits JS is breaking facets tree manipulations.

I built a custom module that interacts with the facet list to become collapsible if you have a hierarchical facet.
With the current implementation, the selector used in soft-limit.js breaks if some facet results are still hidden (which could make sense with a collapsible hierarchy).

Steps to reproduce

Consider the following hierarchical facet:

Tree:
- Val 1
- Val 2
-- Val 2.1
-- Val 2.2
--- Val 2.2.1
--- Val 2.2.2
- Val 3
- Val 4
-- Val 4.1
-- Val 4.1.2
- Val 5
- Val 6
- Val 7

With a soft limit of 5 items, Val 1, Val 2, Val 3, Val 4, Val 5 are visible by default. If you click on "view more", Val 6 and Val 7 are shown. If you click on "view less", the values 6 and 7 are hidden. This is consistent.

Now, if you add some JS logic to let the hierarchy be collapsible, the default output of the facet is:

- Val 1
- Val 2
- Val 3
- Val 4
- Val 5
- Val 6
- Val 7

The soft limit shows Val 1 to 5. If you click on "view more", you see Val 6 and Val 7 BUT if you click on "view less", Val 6 and Var 7 are not hidden due to the fact that Val 2.1, Val 2.2 and so on are still hidden.

This is due to the current selector used in the script.

Proposed resolution

Change the selector to apply to direct children li.

πŸ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡«πŸ‡·France artusamak Bzh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024