elixir-lang/ex_doc

UX issues related to search bar location

Closed this issue · 6 comments

While I'm generally quite positive on the redesigned search bar, there are a handful of UX issues I've noticed that are a result of its new location at the top of the content portion of the page as opposed to the sidebar (which is sticky).

  1. Least important, but worth mentioning: It is less discoverable, especially if you navigate directly to an anchor link that is farther down the page.
  2. The / search focus keyboard shortcut instantly scrolls you to the top of the page, which is jarring and causes you to lose context. (I am often searching for something related to what I'm looking at.)
  3. Related to 2, the jump to page top causes a loss of scroll history. Consider: you're halfway down a page, press / to search, navigate to a search result, then press the back button. Previously, your browser would restore the scroll position of the page you were originally on, but that is no longer possible as the / caused a scroll to the top of the page.

The easiest way to experiment with this is using the Elixir docs:

This issue is related to #1835, which could be used as inspiration for a solution.

I think we could always make it show up on scroll up, regardless if on mobile/small screens. / would just bring it up immediately. WDYT?

Sounds great to me!

Hello!

I personally find navbars peeking out on scroll up quite jarring. It makes perfect sense on mobile, but I really dislike it on desktop. Of course this is just my opinion and I would gracefully accept being veto'd, but I'm also more than happy to do the work to make it slide into view when hitting / (and ideally with super-k as well).

@sodapopcan That would be perfectly acceptable to me.

Please do send a PR for / then! Feel free to add super k as well.

Will do! It's already in the works and I should have a PR soon.