Giter Club home page Giter Club logo

Comments (8)

lelouch77 avatar lelouch77 commented on June 17, 2024 1

Thanks for reporting @Nilanth, I will take a look 👍

from docusaurus-lunr-search.

lelouch77 avatar lelouch77 commented on June 17, 2024 1

This issue happens only when you select a result which is already an active URL..

from docusaurus-lunr-search.

Nilanth avatar Nilanth commented on June 17, 2024

No, it occurs on all pages!
You can check in this demo itself https://lelouch77.github.io/docusaurus-lunr-search-demo/

from docusaurus-lunr-search.

mattcorner avatar mattcorner commented on June 17, 2024

When moving from landing page to documentation the search is cleared. However @Nilanth is right that once in the documentation, the search is never cleared.

from docusaurus-lunr-search.

lelouch77 avatar lelouch77 commented on June 17, 2024

Thats the old documentation link.. try this https://lelouch77.github.io/docusaurus-lunr-search-multilang @Nilanth @mattcorner

from docusaurus-lunr-search.

mattcorner avatar mattcorner commented on June 17, 2024

Its a bit inconsistent. Sometimes it does remove clear the search, but a lot of the time it doesn't. Here it is not clearing on the new demo @lelouch77

This only occurs for doc to doc navigation

docs-lunr-search-not-clearing

from docusaurus-lunr-search.

felipeog avatar felipeog commented on June 17, 2024

Hi,
The search text in the search bar is not removed once we click the search result.

On /src/theme/SearchBar/index.js, I added _input.setVal('') and _event.target.blur() on the handleSelected function (line 25):

const initAlgolia = (searchDocs, searchIndex, DocSearch) => {
  new DocSearch({
    searchDocs,
    searchIndex,
    inputSelector: "#search_input_react",
    handleSelected: (_input, _event, suggestion) => {
      const url = baseUrl + suggestion.url;
      const a = document.createElement("a");
      a.href = url;

      _input.setVal(''); // clear value
      _event.target.blur(); // remove focus

      history.push(url);
    }
  });
};

So the input is cleared and its focus is removed when a result is clicked. Hope it helps!

from docusaurus-lunr-search.

praveenn77 avatar praveenn77 commented on June 17, 2024

fixed in new version 3.2.0

from docusaurus-lunr-search.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.