-
Notifications
You must be signed in to change notification settings - Fork 318
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
Proof of concept for client-side search support (WIP) #221
base: master
Are you sure you want to change the base?
Conversation
Added a "hidden until focussed" skip link as the first interactive element on the page Tabbing through the page, it takes over 100 key presses to get to the main content due to the "Tags" links and the GitHub "Avatar" links. https://webaim.org/techniques/skipnav/ Added a `<main>` element to the page as this landmark can be used by assistive technology
Pull latest from upstream
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/stefanjudis/tiny-helpers/5k7727egl |
{% set js %} | ||
{% include "js/search.js" %} | ||
{% endset %} | ||
{{ js | safe }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do jsmin
here to reduce the JS size down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we should def do that. :)
Thank you so much Jon for spending some time on this. :) I had a look at the overall functionality and have some concerns/questions. :)
For me, this feels a little bit confusing. People entering on
Sweet! 👍 I still wonder if we can't leverage a function here and reuse the The templates are already in a re-useable format so that we could set up a server-side variant and render the data in a function defined in What do you think of this? |
Yer... I wasn't too sure how to handle this as the tags filtering kinda overlaps with search filtering. So are you thinking there is a real server-side rendered page using node.js that can serve up a filtered helpers page? If so, once a user accesses "/search/${query}" and the server returns the HTML with just the matching helpers, if the user types in a new search term, how are the new results displayed? Is a full page reload performed to get the server to return the HTML for the new page? |
You have the data available in the JSON feed that this PR already includes. One could use this data to toggle a class on hidden helpers or re-render the list. :) The logic wouldn't differ much from what is included in this PR in the client already. :) Does that make sense? :) |
I think I follow but just want to double-check... Statements
Question |
Cool. Thanks for writing this down.
I feel like we can ignore tags in that case and query all tools. If the form has a proper label like |
What is the status of this PR? What can we help to get this merged? |
I can see a merge conflict in |
Just wanted to pop in here and mention you would definitely be accepted into the Algolia "DocSearch" opensource program (https://docsearch.algolia.com/). Its a service they host / sponsor which scrapes static sites every 24hr and offers a nice simple search. You've probably seen it as that "Ctrl + K" search on many code documentation sites lately (for example tailwindcss and NextAuth.js are both using it). |
Thanks @ndom91. :) That's right, Algolia search is client-side only, though. And while my opinion about JS-only search softened a little bit, I still think a server-side first approach way like a But yeah, I failed to handle this PR (sorry @JonUK :/) and I currently don't have the time to implement such feature, so I guess I'd be open for someone else taking over. :) |
Covered the bare-bones implementation of client-side searching (WIP)
searchData.json
feed file is being generatedsearchData.json
file is bundled up with the search code into a single JS fileq
parameter exists, this is used to do initial filteringIf this is an approach to go forwards with for search then:
TODO