Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search results page table of contents is unhelpful #270

Open
lfdebrux opened this issue Oct 6, 2021 · 1 comment
Open

Search results page table of contents is unhelpful #270

lfdebrux opened this issue Oct 6, 2021 · 1 comment

Comments

@lfdebrux
Copy link
Member

lfdebrux commented Oct 6, 2021

For tech docs which do not use the multi-page nav, the table of contents are confusing.

The table of contents as generated by the Middleman extension has two items, 'Search', and 'Results'.

Screenshot of search page for GOV.UK developer docs showing table of contents with 'Search' and 'Results'

However only one of these headings is visible at any one time.

I think having both links visible at the same time is a bit of a strange one. When there are no results, the Results link takes you nowhere, and when there are results, the Search link takes you nowhere. Or rather, it takes you to #how-to-search, but this is within a

that has aria-hidden on it, so presumably the anchor won't resolve for assistive tech users in these cases.
 - #263 (review)

Fixing this is a little tricky because of the way the table of contents is generated and inserted:

Ah, this is going to be harder than I thought... the naive way to have an empty sidebar navigation is to override the sidebar content in the core erb template, however for mobile devices this either leaves a table of contents button that does nothing, or omits the search box entirely.

So making this change the proper way would involve massively rewriting the core template, which will take time and be risky. I guess the hacky way to do it would be to do it with JavaScript; this will be slightly easier, but not so great maintenance wise.

... Also, I'm not sure how with JavaScript we could detect whether the page is using a multipage nav or not.
 - #263 (comment).

@m-green
Copy link
Contributor

m-green commented Nov 24, 2021

I've done a bit of digging into this following a conversation with @lfdebrux, and I wonder if the simplest and most user-focused solution is to disable search for docs that do not use multipage_nav.

If you set multipage_nav to false, only one page of content is ever displayed (source/index.html.md.erb). So it doesn't seem to make sense to have full search functionality - there's no apparent user need to search a single page (because you can do that with Ctrl+F), and the structure of the results page would be a bit weird and unhelpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants