question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using autocomplete.js as InstantSearch.js searchbox

See original GitHub issue

copy of https://github.com/algolia/autocomplete.js/issues/216 by @SchmidtDawid

Hi i want to implement autocomplete but i can’t make it work with instantsearch. When i have 2 inputs - one is for searchBox widget and the second is for autocomplete, everything works great (but of course autocomplete doesn’t have impact on hits). But when autocomplete and searchbox pointing on same input i have an error.

Uncaught TypeError: Cannot read property 'style' of null
    at search-box.js:130
    at Object.render (connectSearchBox.js:136)
    at InstantSearch.js:317
    at n (_arrayEach.js:15)
    at r (forEach.js:37)
    at t.value (InstantSearch.js:313)
    at r.n.emit (events.js:84)
    at algoliasearch.helper.js:1245
    at n (_arrayEach.js:15)
    at r (forEach.js:37)

error pointing on this line: resetButton.style.display = query && query.trim() ? 'block' : 'none';.

This is my script list:

  <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3/dist/instantsearch.min.js"></script>
  <script src="/js/algolia_search.js"></script>
  <script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
  <script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.min.js"></script>

I tried every possible configuration, but is doesn’t matter.

I don’t have idea how to solve it. Can you help?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SchmidtDawidcommented, Mar 21, 2018

Yes we write comments almost in same time. I’ll try your solution tomorrow because in my solution selecting autocomplete items by arrows doesn’t change input value.

0reactions
Haroenvcommented, Mar 30, 2018

Awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrate Autocomplete with InstantSearch.js - Algolia
Learn how to use Autocomplete with InstantSearch.js. ... This autocomplete can work as a rich search box in a search page, and a...
Read more >
Algolia JavaScript call the search for autocomplete
I am making a search for paintings and using the algolia api, instantsearch and autocomplete.js. I have added the autocomplete but the ...
Read more >
autocomplete as searchbox - CodeSandbox
Forked Fromautocomplete as searchbox; Environmentparcel. Files .editorconfig .eslintrc.js .gitignore .nvmrc. autocompleteWidget.js. index.css. index.html.
Read more >
Trigger user interactions directly from your search box with ...
The topic of this new Live Coding Session is " Autocomplete Omnibar ... through setting up Autocomplete to fire interactions with JavaScript.
Read more >
Instant search - npm.io
Adapter to use InstantSearch UI widgets with Typesense Search ... Searchbx API Client for JavaScript with instant search experiences.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found