Does not "hide filter, if no options" if "make filter options collapsible" is selected

Created on 12 February 2024, about 1 year ago

Problem/Motivation

When both options are selected, the details/summary element shows. Since the filter is set to hide if no options, we would not expect the details/summary element to appear.

This is partially a duplicate of 🐛 "Hide filter, if no options" does not work if filter is not set to allow multiple Closed: cannot reproduce and Hide "- Any -" in radio view if no term is available. Fixed - the issue is mentioned in both, but I believe the tickets were closed based on other issues mentioned within.

Steps to reproduce

  1. set up a taxonomy with one or more terms
  2. add the taxonomy to a content type
  3. create content in the content type, but do not use the taxonomy terms
  4. create a view listing the content type, adding your taxonomy as an exposed filter
  5. set the exposed filter to use Better Exposed Filters, with "show only used items" and "hide filter if no options" enabled
  6. save the view and note that without making the options collapsible, the filter is removed
  7. enable the setting to make filter options collapsible (in advanced settings)
  8. save the view and note that the filter now displays a details/summary element even though there are no options available

Proposed resolution

Make it so the details/summary is not printed to the screen when these settings are enabled.

Remaining tasks

Write code to do this. :)

User interface changes

n/a

API changes

n/a

Data model changes

n/a

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇦Canada kpaxman

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

Merge Requests

Comments & Activities

  • Issue created by @kpaxman
  • Status changed to Needs review 4 months ago
  • 🇨🇦Canada kpaxman

    My branch provides a potential fix. (It seems to work for us, not sure if there would be any side effects.)

  • 🇨🇦Canada kpaxman

    We have found one case with this patch where there is still an issue; we are looking to see if we can figure it out.

    If you have a listing page for a content type that uses taxonomy terms, and a better exposed filter on the term, with "show only used items" and "hide filter if no options" enabled:

    • when the content type has no content whatsoever, the filter is successfully hidden
    • when the content type has content, and there are no taxonomy terms defined yet, the filter is shown, even though it shouldn't be

    If you create a taxonomy term, even if you don't use it in the content, the filter works again.

  • 🇨🇦Canada kpaxman

    I've updated the branch/MR to hide the group if there are no terms whatsoever.

Production build 0.71.5 2024