kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Redesign learn search with header search bar, autocomplete, and filter pills

Open rtibbles opened this issue 5 months ago • 2 comments

Summary

Extracts the learn search redesign from the ai_assistant prototype branch, rebuilt on develop as reviewable commits.

The library and channel/topic pages get a header search bar with autocomplete (instant fuzzy matching against translated metadata labels, debounced content matches from the backend), recent searches, and resumable content shortcuts. Applied filters and still-available refinements render as a horizontal pill row, with the full filter set moved to a side panel. Keyword search moves from the bespoke ContentNodeSearchViewset to a DRF SearchFilter backend on the main contentnode endpoints, and the old endpoint is removed.

The frontend sends keyword searches as a question query parameter, which the backend treats as plain keyword search for now — groundwork for the AI assistant integration, which will substitute its own handling of question without further frontend changes.

State Screenshot
Library page Library
Autocomplete (metadata suggestions) Autocomplete
Search results with filter pills Results
All filters side panel Panel
Mobile library Mobile library
Mobile channel page Mobile topic

Search flow recording

https://github.com/user-attachments/assets/c7506d1d-d622-49e8-a1c8-f221c063306a

axe audits on the captured pages report no violations introduced by this branch; pre-existing issues (card progress bar accessible names, KCard <li> outside a list on mobile grids, channel logo missing alt, skip-link contrast) are unchanged from develop.

References

Prototype origin: rtibbles/kolibri:ai_assistant — the AI-specific work remains there and will follow separately.

Reviewer guidance

  • On the library page: type in the search bar — metadata label matches appear instantly, content matches follow; selecting a metadata suggestion applies that filter and strips the matched words from the query; Enter submits the remaining keywords; pills toggle filters on/off
  • Open a channel: the same search bar appears in the header, scoped to that channel/folder
  • Resize to a small viewport: topic pages show the search header below the mobile header, and "All filters" becomes a centred button
  • Keyword search API: /api/content/contentnode/?search=… (also accepts question and legacy keywords); the dedicated contentnode_search endpoint is gone, and custom channel (kolibri-sandbox) search was migrated to the main endpoint — testing custom channels is out of scope here

AI usage

This branch was prepared with Claude Code: it extracted the search frontend from the ai_assistant prototype branch (itself pair-written with Claude), rebuilt it on develop as logical commits, migrated the specs to Vue Testing Library, and verified the flows in a live browser (screenshots and recording above). I reviewed the full diff twice with inline feedback — Composition API conversion, string consolidation out of components, and corrections against the design spec — which Claude then applied.

🤖 Generated with Claude Code

rtibbles avatar Jun 04 '26 23:06 rtibbles

npm Package Versions

[!WARNING] The following packages have changed files but no version bump:

Package Version Changed files
kolibri 0.18.0 3

If these changes affect published code, consider bumping the version.

github-actions[bot] avatar Jun 04 '26 23:06 github-actions[bot]

"first search" of suggested filters doesn't actually seem to match any results.

Doubtless something going awry in the deferred population logic. Will look at it.

The listbox is not reading the options in screen reader (I do think having Radina do QA on this beyond me would also be valuable, but a first observation at least)

I think listing all the options immediately on appear would not be a good user experience - what we need is to trigger an aria-polite message saying that X results are available, I think - so that users know to keyboard navigate to them.

If i am getting 2 fuzzy matches, I wish there was a way to select both in the single search. I have not figured out how to do so (if it is possible). I would prefer this over the partial keyword and partial filter.

The only way I can think of UX wise is to present the "all fuzzy matches" first, then do combinations - this is better in some ways as one of the functions of the fuzzy match is purely to educate the user about the filter options available, so more is more.

Relatedly, I can end up with a partial search when i really just want the filter

This and the above may be best resolved by doing non-eager application of filters - I suspect that it is rather 50/50 though, and people's expectations might be for instant filtering. Given our reasonable query performance it seems OK to let people 1 click then refine.

icons have colours, some not

It was definitely like that when I got here - but great idea, boss, what colours should the monochrome ones be?

rtibbles avatar Jul 01 '26 15:07 rtibbles

icons have colours, some not

Revisiting the spec, non-activity icons are meant to be blue.

rtibbles avatar Jul 01 '26 16:07 rtibbles

🔵 Review posted

Last updated: 2026-07-17 07:11 UTC

rtibblesbot avatar Jul 04 '26 20:07 rtibblesbot

For the matches - the grouped matching was in direct response to your previous feedback around clicking on individual filters searching immediately.

One possibility here would be to try to nuance it and only present "grouped" matches when they fuzzy match on distinct terms in the search query? I think that might be the best way to thread the needle.

rtibbles avatar Jul 14 '26 21:07 rtibbles

For the matches - the grouped matching was in direct response to your previous feedback around clicking on individual filters searching immediately.

Yes, I realize the change here was because of other feedback I had 🙃 I like the sound of this approach. If it's not a huge amount of effort, let's give that a try and then I think all of this will be 👍

marcellamaki avatar Jul 14 '26 21:07 marcellamaki

Updated to fix the issue, and reduce superfluous results. Also fixed term highlighting to not mark whitespace and to show up properly for the combination option:

https://github.com/user-attachments/assets/a751a9fb-43e0-4197-a934-cfbade480e42

rtibbles avatar Jul 14 '26 23:07 rtibbles

Observed the following issues while manually testing today and testing will continue tomorrow:

  1. If after having applied a filter I go to 'All filters' and deselect the applied filter, then when I reopen 'All filters' I can see that the filters are not returned to their default state:

https://github.com/user-attachments/assets/b9833723-cf59-4c72-bb7b-0c375c4e5852

  1. Initiating an autocomplete search from within a channel on the device or while exploring other libraries and then clicking the browser's back button brings me back to the Library page instead of bringing me to the previous location on which I was:

https://github.com/user-attachments/assets/2672350c-7aef-4f69-9600-bc651f1fc3af

  1. Going to Library > Explore libraries results in seeing the search field covered by the black 'Explore libraries' toolbar regardless of the size of the browser window:

https://github.com/user-attachments/assets/973f3231-8142-4501-bdfa-2eb4ff0ccde5

  1. I'm seeing all of the available filters while exploring a network device with a single small channel:

https://github.com/user-attachments/assets/1fa72aac-0335-4dd1-8940-c879ec771afd

  1. After initiating a search with 0 results all the other pills disappear but the 'All filters' is shown and clicking it results in seeing all filters disabled so in that case it should also be hidden:

https://github.com/user-attachments/assets/f5f6673e-119e-4b41-ba7d-ce8f46c3fe47

Suggestions for improvement:

  1. The search submit button should be disabled when there's no entered keyword in the search field and the contrast ratio of the text 'Find something to learn' should be increased:
disabled icon and visible text
  1. If I have already completed a search, when I enter a new keyword and select an item from the autocomplete, then I can see the resource but when I click the back arrow I'm brought back to the search results from the previously initiated full search which can be a bit confusing. I think in that case it would be more appropriate to either bring the user back to the default state of the Library page or show results for the last entered keyword (for which a search was initiated through the autocomplete):

https://github.com/user-attachments/assets/65909f1b-441c-4c88-8769-4439979ca54d

pcenov avatar Jul 15 '26 15:07 pcenov

Fix Screenshot
Deselecting a filter resets the panel to its default state. It also no longer closes on every click.
Back from an autocomplete result returns to the channel or library you were in.
Search bar clears the 'Explore libraries' toolbar at every window size.
A network device shows its own filters, not the local library's.
'All filters' is hidden when no filter could yield a result.
Submit disabled while the field is empty; placeholder contrast raised to 5.7:1.
Back after picking a suggestion shows results for the keyword you typed, not the previous search.

rtibbles avatar Jul 16 '26 03:07 rtibbles

Hi @rtibbles,

I confirm the applied fixes with the following outstanding issues:

  1. A note that it's nice to have the filter not closing on every click but in mobile resolution where the filter is taking up all the screen if it doesn't close on every click the user has to manually close it to see the results:

https://github.com/user-attachments/assets/cebf8e52-8d62-41d3-92d3-7a27a37be442

In addition to that the filter no longer closes on every click only at the Library page, but closes immediately when the user is using it from within a channel or a network device/other library:

https://github.com/user-attachments/assets/b2bf0bdb-fca9-487b-8751-8c5243627902

  1. The search is not returning the correct results when initiated within a specific channel, network device/other library:

https://github.com/user-attachments/assets/c5a17c34-19e9-404b-8f2c-168214e77878

  1. While exploring a network device I am seeing results for an unlisted channel. Clicking on the returned result brings me to /#/resources-unavailable and I'm seeing the following error in the console:
TypeError: this.learnString is not a function
    at l.pE (ContentUnavailablePage.vue:1:115)

https://github.com/user-attachments/assets/0934c4c7-fbdf-4d5c-895b-253099686b3c

pcenov avatar Jul 16 '26 12:07 pcenov

Fix Screenshot
Applying a filter within a channel or network device keeps the filters panel open.
Searching a network device or other library now filters results by your search term.
Searching a network device no longer returns resources from unlisted channels.
An unavailable resource now shows the “No resources available” page.

rtibbles avatar Jul 17 '26 02:07 rtibbles

Hi @rtibbles - I confirm all of the latest fixes. No new issues observed while regression testing! 🥇

pcenov avatar Jul 17 '26 11:07 pcenov