mkdocs-material: Gracefully disable search on file:// if Worker initialization fails

I checked that…

  • … the documentation does not mention anything about my problem
  • … the problem doesn’t occur with the default MkDocs template
  • … the problem is not in any of my customizations (CSS, JS, template)
  • … there are no open or closed issues that are related to my problem

Description

I was using v4.x without any of issues, but once I upgraded to v5 RCs (tried all 3) my navigation bars (both left and right) seem to not be fixed anymore, but rather move out of the frame when I scroll down. Please have a look at .gif attached.

scroll_issue

One thing that might help understand the problem is that this issues only occurs when I run the built .html offline. When I use locolhost and “mkdocs serve”, this behaviour does not occur.

Expected behavior

The navigation shall always be visible, as it was for me in v4.x.

Actual behavior

When I scroll down my page the navigation is not there anymore.

Steps to reproduce the bug

  1. install any v5 RC
  2. mkdocs build any configuration
  3. run the static .hmtl e.g. in Chrome

Package versions

  • Python: 3.7.0
  • MkDocs: 1.1
  • Material: 5.0.0rc3

Project configuration

site_name: MkDocs
site_url: https://www.mkdocs.org
site_description: Project documentation with Markdown.
site_author: MkDocs Team

repo_url: https://github.com/mkdocs/mkdocs/
edit_uri: ""

theme:
    name: 'material'
    highlightjs: true
    hljs_languages:
        - yaml
        - django
    feature: 
        
      

nav:
    - Home: index.md
    - User Guide:
        - Writing Your Docs: user-guide/writing-your-docs.md
        - Styling Your Docs: user-guide/styling-your-docs.md
        - Configuration: user-guide/configuration.md
        - Deploying Your Docs: user-guide/deploying-your-docs.md
        - Custom Themes: user-guide/custom-themes.md
        - Plugins: user-guide/plugins.md
    - About:
        - Release Notes: about/release-notes.md
        - Contributing: about/contributing.md
        - License: about/license.md

extra_css:
    - css/extra.css

markdown_extensions:
    - toc:
        permalink: false
    - admonition
    - def_list


copyright: Copyright &copy; 2014 <a href="https://twitter.com/_tomchristie">Tom Christie</a>, Maintained by the <a href="/about/release-notes/#maintenance-team">MkDocs Team</a>.
google_analytics: ['UA-27795084-5', 'mkdocs.org']

System information

  • OS: Win10
  • Browser: Chrome 80.0.3987.149

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Great, that did the trick. No more error messages and the the side bars stay in place 😃

Only the search function itself is not working for me now. (When I´ve started typing it still says “Type to start searching” and on Enter nothing happens).

It doesn´t work neither with the local iframe-worker.js nor via the web link. How can I help debug?

edit: please ignore the above, I found that it was due to a leftover .html file in my partials/lanuguage folder. It´s working now, awesome!

Ok, I guess I´ll wait a few more weeks as it´s not urgent for me. I actually used localsearch with 4.x without any problems, but also saw that @wilhelmer is working on an update of the plugin for v5.

Thanks for the great work!