Method for Navigating Search in this Topic Results

AI-generated summary

The discussion revolves around navigating search results within a topic on Discourse. Finder seeks a way to move between results using a handler or keyboard shortcut, as the current Find function fails due to lazy loading and virtual lists. NateDhaliwal suggests using arrow keys, referencing the available keyboard shortcuts. Finder clarifies that while the results list persists, there’s no easy way to index through them—only manual scrolling and reopening the search menu, which disrupts workflow. tobiaseigen moves the thread to #feature, requesting more details and a screencast. Finder confirms the issue and provides a video demonstrating the problem, emphasizing the need for a seamless navigation method like prev/next buttons or shortcuts to avoid the repetitive process of reopening the search menu.

Is there a handler to navigate previous and next through the recent “Search in this Topic” results?

Since lazy loading and virtual lists break browser native Find on all but the shortest topics I think it’s important to replicate that functionality.

I am pretty new to Discourse, I’ve done a search through the meta and the source but I didn’t turn anything up, but it seems like it would be pretty important so I might be missing it. Thanks!

1 Like

I think arrow keys should do the trick. You can see the available keyboard shortcuts by clicking the keyboard button in the sidebar on desktop.

The goal is to traverse a topic without bouncing back and forth between the topic and the search results.

In long posts it’s difficult to keep your place in the results, especially as the scroll position resets each time you press a result.

So it would work like the j and k selectUp selectDown handlers except that it would skip over replies that weren’t part of the recent Search this topic results selecting only replies that were.

4 Likes

In my estimation it would be reasonable to persist an offscreen list of replies (like an array) and then simply index through them with previousResult nextResult handlers, resetting the list whenever a new topic was loaded or a new search was performed.

Of course keyboard shortcuts and/or buttons would then become trivial.

3 Likes

Hey @finder welcome to Discourse!

I am sliding this across to Contribute > Feature because this sounds like a new feature request. If you could share more insight into the issue you are experiencing, perhaps with a screencast, that would make it easier for us to understand what you are asking about. Can you share more about your setup?

This feels rather complicated to me, since it would remove context.

Actually the Results List already persists across clicks, but there is currently no way to index through results (like a prev/next result button, handler or keyboard shortcut) except manually.

This video shows Find failing since discourse uses Lazy/Virtual lists, so we switch to Search within this topic, but there is no easy way to navigate between results without reopening the search menu, which cover the page, so it must be dismissed to scan over a result, then re-opened, scroll again, manually find the last result we selected, and click the result after that.

It is made worse since the search results cover the page so they must be dismissed to read a post and reopened every time.

If we’re going to replace the browser native Find function, which has existed in its current state since time immemorial, it should be at least equivalent in function.

The list is there, computer are great at moving through lists, and I can’t see anything complicated about it.