When searching in viewer, help user navigate any results
When searching in ReadingToolbar, we should add a Dropdown to the Search field that helps users see and navigate to results inside the Viewer.
I've mocked up how the dropdown could appear:
- When the search field is empty, cleared, or a search hasn't yet run (results are
nullinstead of[]), don't show a dropdown. - When the search field has a query and the search has been run, show the "summary" header with the currently selected result, the total number of results, controls to jump between results, and a toggle to reveal detailed results with additional context.
- When the search field or search dropdown has focus, automatically open the results list. When it blurs, automatically close the results list. Clicking a result should focus on that result in the viewer and, as a result of blurring, toggle the results list closed.
Results could be rendered with animate:flip.
Showing results could be discarded if it ends up being too complex in experience or implementation.
From Sam at Unredacted:
The in-viewer search facility is MUCH weaker than before. When you search for a term now, it doesn’t give you a set of results – instead it just highlights each instance of the term. But you aren’t told how many results there are, or on which page, or even if there are any results! You can imagine a 700-page document, and searching for a term which appears on p. 570, but you’d never know unless you diligently scrolled through the entire document! This feels like a real backwards step, given how powerful the existing in-viewer search facility and results display is.
Had similar feedback to Sam's in one of the user testing sessions — I didn't realize snippet search (to make up a name for what we use now) wasn't included in the revamp because in-document search wasn't working at all, but I think having the ability to use solr-style advanced search queries and see snippets of context around document searches is really powerful for users. Having in-browser search to quickly skim + that seems like it would be a great combo.
Do we have any solr logs showing how people actually used advance search on individual documents?
This will be an enhancement to the document view - the language around improvements to search will be for now, before launch #909