Skip to content

Stop the clusters live-filter from collapsing sections it hasn't searched#828

Open
LukasWallrich wants to merge 2 commits into
mainfrom
fix-clusters-live-filter-search
Open

Stop the clusters live-filter from collapsing sections it hasn't searched#828
LukasWallrich wants to merge 2 commits into
mainfrom
fix-clusters-live-filter-search

Conversation

@LukasWallrich

Copy link
Copy Markdown
Contributor

Summary

  • The clusters page's live filter (Focus/Type tags, specialist toggle, and free-text search — all bound to the same search box) only checked enriched resource cards for matches.
  • A query that only appeared in a sub-cluster's own heading or description (not any card) produced a match count of 0, which disabled and collapsed that section — including ones plainly relevant to the search.
  • Reproduced on the live page: searching a phrase taken verbatim from a sub-cluster description collapsed 93/93 accordion sections site-wide.

Changes

  • Cache each section's own heading+description text alongside its cards in initFiltering().
  • Treat a query match against that own text as sufficient to keep the section open (skip the disable path, fall through to the existing isFiltered branch that auto-expands on match) even with zero matching cards.
  • Only applies when no Focus/Type facet is active, since those are card-specific metadata a sub-cluster's own text can't satisfy.

Test plan

  • Repro phrase ("weigh in on current developments", from a sub-cluster description) now keeps that section open, accurately showing "0" cards matched
  • Non-matching sections still correctly disable for the same query
  • Card-title/summary search unaffected (verified with a query that matches cards directly)
  • Focus/Type facet-only filtering unaffected
  • Clearing the search box fully restores all sections

🤖 Generated with Claude Code

…ched

The live filter (Focus/Type tags, specialist toggle, and free-text
search - all bound to the same search box) only checked enriched
resource cards for matches. A query that only appeared in a
sub-cluster's own heading or description text (not any card) produced
a match count of 0, which disabled and collapsed that section -
including ones plainly relevant to the search. Reproduced on the live
page: searching a phrase taken verbatim from a sub-cluster description
collapsed 93/93 accordion sections site-wide.

Cache each section's own heading+description text alongside its
cards, and treat a query match against that text as sufficient to
keep the section open (skipping the disable path, then falling through
to the existing "isFiltered" branch that auto-expands on match) even
with zero matching cards. Only applies with no active Focus/Type facet,
since those are card-specific metadata, not something a sub-cluster's
own text can satisfy.

Verified in browser: the repro phrase now keeps its actual matching
section open (accurately showing "0" cards matched, since none
individually mention the phrase) while non-matching sections still
correctly disable; card-title/summary search and Focus/Type facet
filtering are unaffected; clearing the search box still fully restores
all sections.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@LukasWallrich LukasWallrich requested a review from a team as a code owner July 2, 2026 11:37
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

👍 All image files/references (if any) are in webp format, in line with our policy.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

✅ Spell Check Passed

No spelling issues found when checking 7 changed file(s)! 🎉

@LukasWallrich

LukasWallrich commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Staging Deployment Status

This PR has been successfully deployed to staging as part of an aggregated deployment.

Deployed at: 2026-07-02 15:06:58 UTC
Staging URL: https://staging.forrt.org

The staging site shows the combined state of all compatible open PRs.

@richarddushime richarddushime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor issue is that once selected one focus, the rest of the subclusters are deactivated, untill a refresh or selecting All

the links would be better if remained active and collapsed

Image

@LukasWallrich

Copy link
Copy Markdown
Contributor Author

@richarddushime I am not sure what behaviour you would suggest? Clear the search when clicking to expand a section? That might be somewhat unexpected behaviour and should then probably also apply to the filters?

The filter bar had no explicit reset: getting back to everything meant
backspacing the search box and clicking "All" on each facet. A Focus tag
also greys out non-matching sub-clusters, so a filtered view could feel
stuck until refresh.

Add a "Clear filters" chip that appears only when a restrictive filter
(search text or a non-"All" Focus/Type tag) is active. Clicking it empties
the search box, resets Focus/Type to "All", unchecks the specialist toggle,
re-applies filtering, and refocuses the search input.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants