Skip to content

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

Merged
yangshun merged 1 commit into
masterfrom
lex111/fix-algolia
May 17, 2020
Merged

yangshun merged 1 commit into
masterfrom
lex111/fix-algolia

Conversation

@lex111

@lex111 lex111 commented May 17, 2020

Copy link
Copy Markdown
Contributor

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
inputSelector: '#search_input_react',
algoliaOptions: algolia.algoliaOptions,
autocompleteOptions: {
openOnFocus: true,

Copy link
Copy Markdown
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
@lex111
lex111 force-pushed the lex111/fix-algolia branch from 42c7a5f to 82ee861 Compare May 17, 2020 15:24
@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
Copy Markdown
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 42c7a5f

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

@docusaurus-bot

Copy link
Copy Markdown
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
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
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.

4 participants