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.

Unable to autofocus searchbox

See original GitHub issue

Describe the bug 🐛

AIS searchbox is not autofocused even when autofocus input is set to true. See code below:

<ais-search-box [autofocus]='true' placeholder="Search"></ais-search-box>

I’ve read through PR #208 and this seems to add the autofocus feature. Maybe I’m not implementing it correctly?

To Reproduce 🔍

Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

A live example helps a lot! We have a simple online template for you to use for your explanations:

https://codesandbox.io/s/github/algolia/create-instantsearch-app/tree/templates/angular-instantsearch

Expected behavior 💭

A clear and concise description of what you expected to happen.

Screenshots 🖥

If applicable, add screenshots to help explain your problem.

Environment:

  • OS: mac (10.14.2)
  • Browser: Chrome
  • Version 71.0.3578.98

Additional context

Add any other context about the problem here.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lukemoderwellcommented, Feb 14, 2019

@tkrugg nothing on Algolia’s side. The issue was tracked down to this bit of code in our index.html:

  try {
      Typekit.load({
        async: true
      });
    } catch (e) {
      console.error(e);
    }

Seems like somehow our fonts loading removes focus on the search input. I’ve resolved by moving this down the page. Thanks again to @samouss for taking the time to help.

1reaction
lukemoderwellcommented, Feb 13, 2019

I’ve tracked this back to the usage of Google Tag Manager. When I remove our tag manager script from index.html suddenly autofocus works 🤷‍♀️. Not sure what script exactly but will continue to debug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Focus Property is not working in Text Input Component ...
I am making a Search Bar and I want they keyboard to open up once the Search button has been clicked however the...
Read more >
Why would the search input field not get focus when the page ...
I'm on Windows. It occurs to me it might be functionality that's added by an extension. Either way, it get's broken if you...
Read more >
searchBox | InstantSearch.js - Algolia
The searchBox widget is used to let the user perform a text-based query. This usually is the main entry point to start the...
Read more >
Auto-focusing into the search box (U29.5) - Art, Animation, & UI
i have been waiting for Search Box autofocus to be fixed for like, 3, maybe 5 years. the solution, is for entering the...
Read more >
Set Input Focus with HTML5 autofocus | SamanthaMing.com
Note you can't apply autofocus on inputs of type hidden because hidden inputs can't be focused. ... Also, autofocus can only be on...
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