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

chore: fix docs search option in mobile view #15910

Closed
wants to merge 2 commits into from

Conversation

amareshsm
Copy link
Member

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

  • Documentation update
  • [] Bug fix (template)
  • New rule (template)
  • Changes an existing rule (template)
  • Add autofix to a rule
  • Add a CLI option
  • Add something to the core
  • Other, please explain:

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?

@eslint-github-bot eslint-github-bot bot added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels May 23, 2022
@netlify
Copy link

netlify bot commented May 23, 2022

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 789ebc1
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/628f64748f799a00086b21c4
😎 Deploy Preview https://deploy-preview-15910--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@amareshsm amareshsm changed the title fix: docs search option in mobile view docs: fix docs search option in mobile view May 23, 2022
@eslint-github-bot eslint-github-bot bot added the documentation Relates to ESLint's documentation label May 23, 2022
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels May 26, 2022
}
searchInputs.forEach((searchInput) => {
searchInput.addEventListener('keyup', function (event) {
const resultsElement = document.querySelector(`#${searchInput.id}-results`);
Copy link
Member

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)

Copy link
Member Author

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) {}.

Copy link
Member Author

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.

@mdjermanovic mdjermanovic changed the title docs: fix docs search option in mobile view chore: fix docs search option in mobile view May 26, 2022
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label May 26, 2022
@mdjermanovic mdjermanovic removed bug ESLint is working incorrectly documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion labels May 26, 2022
@mdjermanovic
Copy link
Member

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):

https://docs.eslint.org

@amareshsm
Copy link
Member Author

I guess the search component needs to be replaced. https://new.eslint.org/blog/ also uses the same search component.

@mdjermanovic
Copy link
Member

It seems that this will be fixed by #15944 ?

@nzakas
Copy link
Member

nzakas commented May 31, 2022

Yes, I believe it will be fixed. Let’s hold off on this to verify.

@nzakas
Copy link
Member

nzakas commented Jun 9, 2022

I believe this should be fixed now. @amareshsm can you confirm?

@amareshsm
Copy link
Member Author

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

@amareshsm amareshsm closed this Jun 9, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 7, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants