-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
784 faq page #812
784 faq page #812
Conversation
…returns number of results matching search term
@adamkendis running into two logged errors currently that I haven't been able to fix. They are working as expected, but still log errors. line 29 of FaqHeader, getting "TypeError: Cannot read property 'target' of undefined but it does seem to read the value and insert it into the input line 69 of FaqHeader, getting TypeError: Cannot read property 'appendChild' of null, it is appending each line that matches to the autocomplete div |
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.
Hey Hannah, this is really excellent. Works great, completely keyboard accessible. One small change to the position of the link in the header. Regarding the errors, I'm somewhat sure this is what's happening.
const autocompleteDiv = document.querySelector('.autocomplete-items');
const searchBox = document.querySelector('#autocompete-search');
The first time the FaqHeader
function is called, autocompleteDiv and searchBox are initialized before the function returns the html. So, .autocomplete-items
and #autocompete-search
don't exist at the time the variables are initialized, but only the first time the component mounts. You can see this by console logging autocompleteDiv and searchBox right after they're declared and/or inside the handleChange function.
I think you can eliminate the errors by using the useRef
hook instead of document.querySelector because the hook operates inside the component's lifecycle.
Great job!
@@ -35,6 +35,11 @@ const Header = () => { | |||
|
|||
<div id="navbar" className="navbar-menu"> | |||
<div className="navbar-end"> | |||
<div className="navbar-item"> |
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.
Could you move the help center link to the right side of the header?
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.
Move to the right! Combined with the responsive navbar you pushed up, it now pops up on the left next to toggle when page scales down FYI
client/components/faq/FaqHeader.jsx
Outdated
const autocompleteDiv = document.querySelector('.autocomplete-items'); | ||
const searchBox = document.querySelector('#autocompete-search'); |
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.
I'm pretty sure querySelector is causing the two errors you mentioned. Try useRef instead of document.querySelector.
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.
That worked perfectly, took care of the errors!
import FaqRequestTypes from '@assets/faq/311-explain-request-types.png'; | ||
import FaqCompareCouncils from '@assets/faq/311-compare-councils.png'; | ||
|
||
export const FAQS = [ |
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.
I like the way you structured this.
@adamkendis Fixed merge conflict from other changes that were recently made to the navbar. I'm failing lint for that section of the nav that is commented "es lint disabled", do we need to disable the lint check on that section locally? |
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.
Looks good!
Fixes #784
dev
branchAny questions? See the getting started guide