Skip to content

fix: reinstate reference page filter with search by title and desc.#1465

Open
Anshumancanrock wants to merge 2 commits into
processing:v1from
Anshumancanrock:fix/reference-filter
Open

fix: reinstate reference page filter with search by title and desc.#1465
Anshumancanrock wants to merge 2 commits into
processing:v1from
Anshumancanrock:fix/reference-filter

Conversation

@Anshumancanrock

Copy link
Copy Markdown

Problem

The search/filter input on the reference page was rendered but non-functional. The component was never hydrated on the client, so typing into it did nothing.

Fixes: #1401

What this PR does

  • Makes the reference filter functional again. Typing a keyword now filters entries in real-time across all categories and subcategories.
  • Search matches against both entry titles and descriptions (case-insensitive).
  • Added a clear button so users can quickly reset the filter.
  • Shows a "No Results" message when nothing matches instead of just showing a blank page.

Testing

Built and tested locally across all reference categories. Filter matches, clear button, and empty state all work as expected.

@Anshumancanrock

Copy link
Copy Markdown
Author

hii @ksen0 , This PR is up for review, please take a look.

@ksen0

ksen0 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Hi @Anshumancanrock thanks for working on this, it's got some false positives at the moment - by description, what is expected is that the filter filters based on the title and the short description (@limzykenneth please correct me if I've misunderstood the goal though):

image

Also I think only if possible without adding much more lines of code filtering by category title would also be good, ie display the whole category if filter keyword matches.

image

@Anshumancanrock

Copy link
Copy Markdown
Author

Hi @ksen0 , Thanks for catching! Fixed both:

The filter was matching against the full HTML description instead of the short one-line description shown on the page. Now it uses getOneLineDescription() so only title + visible description are matched.

image

@Anshumancanrock

Copy link
Copy Markdown
Author

Also added category/subcategory name matching, so searching "typog" now shows all of Typography, "2D Primitives" shows that whole section, etc.

image

@Nwakaego-Ego

Nwakaego-Ego commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Hi @Anshumancanrock, thank you for working on this. I tested this locally, and here is what I found.

What works well
Filter correctly matches entry titles and visible descriptions, Kit's false positive issue from the first review is fixed. Category-level matching works correctly. The clear button and "No Results" message both work as expected.

Suggested issues to address
The previous implementation used Filter by keyword as the translation key. This key existed in all 5 language files (en, es, hi, ko, zh-Hans) before the filter was removed in #1377. This PR introduces a new key name Filter and only adds it to en.yaml, leaving the other language files untouched. This means users on the Spanish, Hindi, Korean, or Chinese reference page will see the English word Filter as the placeholder text instead of a translation in their own language.
I would suggest restoring the original key name Filter by keyword to stay consistent with how the codebase already does it. For the missing translations in the other language files, I would suggest a separate issue to track this.

Here is how they were translated in PR #1377 before they were removed:
es.yaml - Filtrar por palabra clave
hi.yaml - कीवर्ड द्वारा फ़िल्टर करें
ko.yaml - 키워드로 필터링
zh-Hans.yaml - 按关键字筛选

cc @ksen0 @doradocodes would love your thoughts on this.

@ksen0

ksen0 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Thanks @Nwakaego-Ego ! Good catch on the localization, @Anshumancanrock do you mind adding the strings back based on the link/comment above? Thank you

@Anshumancanrock

Copy link
Copy Markdown
Author

@Nwakaego-Ego @ksen0 Thanks for the review! Good catch on the translation key. I've restored the original Filter by keyword key name and added back the translations for all 5 languages (es, hi, ko, zh-Hans) using the strings from before #1377. Should be good to go now!

@ksen0

ksen0 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Hi @Anshumancanrock sorry to keep going back and forth! But the fact that this is a bit of a subtle feature is the reason it was removed before it could be implemented well! So thank you for the patience. @Nwakaego-Ego thanks for your review, please also include more subtle and weird tests as you keep testing this- same reason as above.

In addition to above tests, I tried the string "sin." In case when there is:

  • word match
  • function name (or I guess section/etc names) match

then partial substring matches should be excluded.

Currently MANY are shown because "sin" is a substring of "since" "single" and "using", which are common words. (I am not trying to be difficult, I just didn't think of it before 😅 )

@Anshumancanrock if you could include all the different tests listed here as unit tests that would be amazing.

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.

Reinstate Reference filter including description

3 participants