mmistakes / minimal-mistakes

:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.
https://mmistakes.github.io/minimal-mistakes/
MIT License
12.48k stars 25.73k forks source link

Algolia Search Toggle Issue #1591

Closed sheldonhull closed 6 years ago

sheldonhull commented 6 years ago

Environment informations


Expected behavior

When I click on search button, I expect the algolia search box to display AND the focus to be on the textbox to allow typing. The issue is no focus is set on Algolia search. I'm not sure what I could have included that would change this behavior as your demo page works and sets focus correctly.

Steps to reproduce the behavior

Production Site with Search enabled

I've tested a local updated build just now and the same behavior is happening.

mmistakes commented 6 years ago

You sure you have the latest version of the theme and its assets (JS, CSS, etc.)? This was fixed in https://github.com/mmistakes/minimal-mistakes/commit/356c1eb0937ab514bda35662afb656e3c06fdeca

Hitting the search icon toggles the Algolia search box and focuses on it for the demo site... which is using the latest version of the theme.

mmistakes commented 6 years ago

Closing as you haven't upgraded to the latest version of the theme. Your main.min.js is still using 4.9.0...

Update that to latest.

sheldonhull commented 6 years ago

Thank you I converted over to the ruby gem approach and thought I had cleared out all contents required. I'll remove those culprits. Thanks for the quick help.

sheldonhull commented 5 years ago

@mmistakes if you get a sec would you mind telling me if I'm doing some obviously wrong with this again? It's not working and I've spent hours trying to fix. I've verified my

Not sure why the button won't click! It's like I messed up something with the javascript, though I searched my entire repo (using remote gem) and couldn't find any code for search or algolia that might be in there.

If you have any ideas I'd appreciate it as I've sunk a lot of time in it, and I'm guessing it's something very simple I'm just clueless on.

mmistakes commented 5 years ago

Whatever you modified, you also removed main.min.js from being included in the page. You need to load that script.

Without it, it's not going to toggle the search bar when you click the icon. That's why it's not doing anything for you.

mmistakes commented 5 years ago

I can see the divs that have the search input and they work. If you can sort out adding back in the theme's main.min.js script to toggle them, search works fine.

screen shot 2019-02-08 at 7 00 00 am

sheldonhull commented 5 years ago

Thank you so much! I will figure out why it's missing. That's the help I needed. Much appreciated

sheldonhull commented 5 years ago

I'm using remote theme and in your documentation I think it points towards this being included in the remote theme. Any tip on why I would be having an issue when I'm not providing that file in the first place? I thought I saw the reference as a resource in the header.

sheldonhull commented 5 years ago

Found it!

Could you consider making the documentation put WARNING notice on the following content:

Site scripts Add scripts to the or closing elements by assigning paths to either head_scripts and/or footer_scripts. For example, to add a CDN version of jQuery to page’s head along with a custom script you’d do the following: https://mmistakes.github.io/minimal-mistakes/docs/configuration/#site-scripts

Per the following content I found in: https://github.com/mmistakes/minimal-mistakes/blob/22a9c523d6be13becc6fe0ed38b065e3489e498f/docs/_docs/17-javascript.md

Note: If you assign footer_scripts the theme's /assets/js/main.min.js file will be deactivated. This script includes jQuery and various other plugins that you'll need to find replacements for and include separately. {: .notice--warning}

I used that section as a reference and only now in searching the repo found out that the footer deactivates the main.min.js

Thanks again! Glad I finally have the solution after all this troubleshooting.