Problem/Motivation

A popular way of handling filters in for instance Commerce situations in the wider web community (ie, outside of Drupal) is to list currently Applied Filters (aka Active Filters) in a separate section (as well as within the filter itself). Particularly useful on mobile where keeping the exposed filters area as a whole open by default can mean the content change is not apparent.

More details:

  1. https://baymard.com/blog/how-to-design-applied-filters
  2. https://cdn.baymard.com/research/media_files/attachments/39153/original/research-media-file-888549a3875d1706e68594a2ea1f3b0f.jpg?1601464585

Steps to reproduce

Create an exposed filter to a taxonomy
Apply the 'Make filter options collapseable' from BEF advanced options
Filter is now collapsed
Use the form and select an option within the filter.
Apply filters
Filter is no longer collapsed

Proposed resolution

Allow site builders to specify that they would like the filters to remain collapsed.

Remaining tasks

Provide merge request

User interface changes

None unless site builder explicitly opts in to the new feature

API changes

None

Data model changes

New config option in schema

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

scott_euser created an issue. See original summary.

scott_euser’s picture

Assigned: scott_euser » Unassigned
Status: Active » Needs review
smustgrave’s picture

Version: 8.x-5.x-dev » 6.0.x-dev
Status: Needs review » Needs work

Tested out the MR but still closed by default.

scott_euser’s picture

Status: Needs work » Needs review

Thanks for trying it out. Staying closed is the intention though.

Without the patch it opens if there is a selected option inside.

With the patch and ticking 'Disable the automatic opening of collapsed filters with selections', it is expected to now stay closed (necessary when the UX practice of 'Applied Filters (aka Active Filters)' is in place described further in the issue summary.

smustgrave’s picture

Gotcha. Could we get a small test for this feature added if you have time?

smustgrave’s picture

smustgrave changed the visibility of the branch 8.x-5.x to hidden.

smustgrave’s picture

Status: Needs review » Fixed

Sorry for the noise.

I ended up adding a test for another issue that seemed aligned with this so I just went ahead and extended the test for here

  • smustgrave committed 87a33ea3 on 8.x-5.x
    Revert "Issue #3266858: Allow not automatically opening collapsed filter...

smustgrave’s picture

Status: Fixed » Needs work

Hate to do it but this caused #3442199: Update hook wiped out config and had to revert. Safer to revert then spend a few days with this in the wild.

smustgrave’s picture

For reporting this issue.

scott_euser changed the visibility of the branch 3266858-collapsed-not-auto-open to hidden.

scott_euser changed the visibility of the branch 6.0.x to hidden.

scott_euser’s picture

Status: Needs work » Needs review

I'm not sure how that upgrade hook ever worked, sorry about that! Sure enough, a quick test and it wipes for me too. Perhaps way back then in 2022 the format was slightly different... Glad you caught it quickly! Updated the update hook + added a test to show its working now (before updating the update hook, test fails with wiped config as expected).

programmerdiego’s picture

smustgrave mentioned that 'Version: 6.0.x-dev" would solve this issue, but it doesn't. Tested on Simple Test Me.

scott_euser’s picture

Yep it got rolled back (see comment #14). Thanks for testing it out, what were the results? Did it solve the problem for you as well?

penyaskito’s picture

Could we have a diff of both upgrade functions? Hard to spot what was wrong, and how this is fixed now.

scott_euser’s picture

Sure, diff is here. The original update hook started with an empty $bef_settings and built it up (and obviously not fully). This update hook starts from the existing config and only modifies the bit it needs to if it finds it.

The original update hook essentially copy pasted from better_exposed_filters_update_8001() and modified which resulted in #3112834: Exposed Filter Settings gone after upgrade.

seanpb’s picture

As discussed in #3442511: "Exclude textfield" from auto-submit logic ignored since 6.0.4 when using autocomplete the change here (https://git.drupalcode.org/project/better_exposed_filters/-/commit/7fbd2...) breaks the ability to disable auto-submit on text fields. The change effectively removes the application of the "data-bef-auto-submit-exclude" attribute.

I'm not sure why this change was made in the first place, perhaps it was due to that attribute causing something to happen on the js side of things? In any case, I doubt that removing this functionality was an intended change.

I've added a patch in #3442511-6: "Exclude textfield" from auto-submit logic ignored since 6.0.4 when using autocomplete reverting that change.

scott_euser’s picture

@seanpb did you mean to post that in this thread? If so, could you explain how it is related to this merge request?

seanpb’s picture

@scott_euser, yes, MR 20 (and 61) caused not only the config-breaking issue but also the one in #3442511: "Exclude textfield" from auto-submit logic ignored since 6.0.4 when using autocomplete. The specific commit that appears to cause the issue is the one linked in my comment above (#25).

  • smustgrave committed 55a5de5b on 6.0.x
    Issue #3266858 by scott_euser, smustgrave, tim-diels, lelkneralfaro:...
smustgrave’s picture

Will post in the other issue but believe these are unrelated since this is just now being committed.

  • smustgrave committed 55a5de5b on 7.0.x
    Issue #3266858 by scott_euser, smustgrave, tim-diels, lelkneralfaro:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.