RFC: Navigation search

Hi everyone!
Now that the navigation (RFC: Navigation once again) is merged we can focus on improving it with a search.

Re-doing @lstejska work from RFC: Menu navigation - Search & go component

@MariSvirik Designed the new search in navigation, you can try it out here (still WIP): Navigation search demo

The search searches menu titles only.
If you have any questions / improvement suggestions please let us know here!


I generally like it from what I can see.
Just a few things I noticed:
Not sure if this is a problem only with the demo setup or a general oversight.
You can search for Organization/Location names in the search and they will show up as suggestions, but selecting them does nothing.
I would have expected it to either:

  • not show the organizations/locations in the search bar or
  • have them do something (either the edit page or select them as active)

Since the demo does not seem to have a “selected org/loc” feature, maybe 2) is what is intended to happen, but I can’t tell :wink:

Also, the search box does not reset the search if you delete the whole content at once (ctrl+a, backspace). Would be nice if that would work, too, but just a nitpick.

I like the search; it is very helpful and looks good with the “Page > Subpage” hints. I’d place it in the top right corner.

I think it’s not just all at once. If you type one letter and then use backspace (so it’s empty) it also doesn’t show anything. Only once you type one letter again it’ll start to provide suggestions. At least for me in the demo using Firefox.

I was already very interested in this when it was brought up on the devconf, great that this is getting progess now!

Some thoughts when playing with the current PR:

  • After reading the previous thread, the location of the searchbox makes a lot of sense in the navigation, but the top bar is also not that much used, lots of blank space, maybe on the right like mentioned here? Also the nav bar can be hidden, which means the search is also out of sight then.
  • This overlaying white box makes the search very pretty when not in use, but it makes you click twice until you can write in there, it doesn’t reset correctly if you just click outside of the box instead of clicking the X (if combined with #1 it might just be the collapsed view/search button)
  • Also as Maximilian is saying it the subpage hints are very helpful (the wordwrapping needs some love)
  • I would really be looking forward to a global page shortcut, which is somewhere mentioned (in the box description, tooltip, …), the hard part might be here finding a shortcut that either works universally on all keyboard layouts or having different once for different layouts (the previously mentioned ` is pretty hard to reach on a German QUERTZ), I was first thinking of Ctrl + F but that will definitely break stuff, so Ctrl + Shift + F might be the next best thing (not in use by browsers as far as I understand it)
  • It would be perfect if the 1st item in the search results list would be selected by default after typing, this would make it possible to hit enter right away without the need of navigating to one of the results

As I saw it again, Kibana is using Ctrl + / for the global search shortcut.

I disagree. In my opinion, this would only make sense if the search bar would ever search for more than just menu items. As long as it only searches menu items, I think keeping it close to the menu makes more sense.

Interestingly, the behavior I observed yesterday differs from what I see now. Today, in both cases I see what you are describing, yesterday when I initially looked at this, just hitting backspace worked as expected but deleting all-at-once just kept the box with results from what was searched last.

I absolutely second both of these! Being able to keep workflows keyboard driven as much as possible would be great! On that note: Could hitting Esc cancle the search and deselect+reset the box? It feels weird to me that it seems to just hide the results, but my cursor stays there and I can keep typing.


Yes, technically you are correct: the search only looks for elements in the navigation. However, the navigation itself represents the functionality of Foreman, so I think, from a user’s perspective, it makes sense to view this as “search in Foreman”. A user does not want to find something in the navigation, but find the actual content. IMHO the navigation is just a means of getting there.

about the shortcut: “/” would be great :technologist:

While true, I still believe putting it somewhere else would raise expectations on the bar to search for more that just navigation elements. If I saw a search bar on the top right, as a first time user I would expect I could search for host names or content view names there and it would take me directly to the page of that specific element. This would be a nice feature improvement to a search bar later on, but until then I stay with my opinion on it’s placement :wink:

This was my first idea as well, but I just found out today that Firefox has bound this key as an equivalent to ctrl+f, so this would probably be a sub-par choice.

1 Like

We already use / in most pages to go to search bar (which is why every search bar starts with a / in a block). I worry it may overlap too much.

As I said above, that’s already taken.

Thanks everyone for the feedback, I will fix some of the bugs that were mentioned here about the demo later :slight_smile:

When the screen is too small to see the org/location selectors in the header, the org/location selection moved to the navigation, so in Foreman clicking on a location from the navigation search will set it. I’m not sure if we want that?

Just to add my two cents: I agree with @areyus on a searchbar in the upper right corner raises exceptions as I would then put in a hostname to directly navigate to the host or similar as it looks more like a search for content. A possible future improvement but not a navigation search.


Nice. Can we limit the amount of search result items that no scroll bar will ever be shown?
Should it be possible to put menu items on a favorite list which will be shown on the top of the search result list?

it is limited to 10 search results, is that too many?

No, as that will require some setting, and as you said in the banner discussion, we have too many settings :slight_smile:


This wouldn’t be a setting as usual. It would be a “star” icon which a user can click on the various pages. Its stored internally on the user “page”