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
chore: fix docs search option in mobile view #15910
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
bd0912c
to
ee411a7
Compare
docs/src/assets/js/search.js
Outdated
} | ||
searchInputs.forEach((searchInput) => { | ||
searchInput.addEventListener('keyup', function (event) { | ||
const resultsElement = document.querySelector(`#${searchInput.id}-results`); |
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.
Would it be more performant to find resultsElement
only once per searchInput
, directly in (searchInput) => {}
instead of in function (event) {}
? (i.e., to move this line two lines up)
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.
yes, we can move outside function (event) {}
.
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.
moved resultsElement
finding logic outside the event listener.
I'm not sure we copied the intended version of the search feature to this repository. The latest version in the development repo differs significantly, so it might be better to wait for @nzakas to verify if this version needs to be fixed or replaced with another one. In particular, there was only one search component, and the same search input and other elements were used on both desktop and mobile (on mobile, search was under the "Index" menu, not under the top menu): |
I guess the search component needs to be replaced. https://new.eslint.org/blog/ also uses the same search component. |
It seems that this will be fixed by #15944 ? |
Yes, I believe it will be fixed. Let’s hold off on this to verify. |
I believe this should be fixed now. @amareshsm can you confirm? |
yes, it is fixed we can close this PR. Closing this PR in favor of #15944 |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
What changes did you make? (Give an overview)
In new docs, the search option was not working in mobile view so implemented the search option in mobile view.
After changes:
Screen.Recording.2022-05-24.at.12.26.42.AM.mov
Is there anything you'd like reviewers to focus on?