Not sure if it fits in one of all "active class" issues.

I have a view with an exposed filter (term). With only that all works ok BUT when you select a term to be used as default element when no filter is present, then "active class" is not working.

I write some js code before .once() and now the active class is working.

CommentFileSizeAuthor
bef-active-class.patch965 bytescarsato
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

carsato created an issue. See original summary.

mikeker’s picture

Status: Active » Needs work
Issue tags: -active class

FYI: When you upload a patch, set the issue status to "Needs review." It help maintainers recognize which issues have something that needs attention vs. those that are just bug reports without a solution.

Anyhow, while this patch fixes the symptom it does not solve the underlying problem and that is what is needed.

mikeker’s picture

Title: active class whenexposing a filter with default value » Incorrect "active" class for link filters with default values
Status: Needs work » Fixed
Issue tags: +needs forward port to Drupal 8

I've fixed up the code that determines which links to put the active filter on and added several tests to ensure this doesn't break going forward. This should fix most of the issues raised here and in #2631804: Wrong filter "active".

Note that there are still some situations where Views makes assumptions about the fact that this will be rendered as a select element. For example, if there is no default value on a non-required boolean filter, the 0 option gets marked as active. But I'm not willing to wait on fixing that before posting this fix.

Also tagging so that this fix doesn't get lost in the D8 upgrade.

  • mikeker committed 787f4b6 on 7.x-3.x
    Issue #2642762 by mikeker: Incorrect "active" class for link filters...

Status: Fixed » Closed (fixed)

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

carsato’s picture

I'll apply the "Needs review" status for future contributions. Good advise.

Thank you, mikeker.