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

fix(v2): avoid duplication search input in navbar #2762

Merged
merged 1 commit into from May 17, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented May 17, 2020

Motivation

In #2756, I defined options for Algolia's autocomplete, but I didn’t take into account that docsearch does not set default values for rest params (custom and default options usually merge).
As a result, on mobiles there was a strange thing after closing the search input:

ezgif com-video-to-gif (1)

This is because the hint option duplicates the search input 🤷‍♂️

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Try using the search on preview from your mobile.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: bug fix This PR fixes a bug in a past release. label May 17, 2020
@lex111 lex111 requested a review from yangshun as a code owner May 17, 2020 15:21
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 17, 2020
@@ -32,7 +32,9 @@ const Search = (props) => {
inputSelector: '#search_input_react',
algoliaOptions: algolia.algoliaOptions,
autocompleteOptions: {
openOnFocus: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a bonus I set this option because it's quite useful from a UX point of view.
If a user closes the block with search suggestions (eg. blur event), then they click on the search input again, these results are immediately displayed, which is very convenient.

@lex111 lex111 changed the title fx(v2): avoid duplication search input in navbar fix(v2): avoid duplication search input in navbar May 17, 2020
@yangshun yangshun merged commit 463efec into master May 17, 2020
@yangshun yangshun deleted the lex111/fix-algolia branch May 17, 2020 15:24
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 42c7a5f

https://deploy-preview-2762--docusaurus-2.netlify.app

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 82ee861

https://deploy-preview-2762--docusaurus-2.netlify.app

@lex111 lex111 added this to the v2.0.0-alpha.55 milestone May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants