Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome print function is broken for instant feature, print dialog opens and closes directly #1631

Closed
4 tasks done
ayeks opened this issue Apr 22, 2020 · 6 comments
Closed
4 tasks done
Labels
bug Issue reports a bug needs reproduction Issue lacks a minimal reproduction .zip file

Comments

@ayeks
Copy link

ayeks commented Apr 22, 2020

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

With versions 5.0.0, 5.1.0, 5.1.1 the Chrome Browsers print functionality is broken when using the instant feature. When you are on a docs page and press Ctrl+P the print dialog opens and closes directly. It works fine in Firefox with these versions.

The print dialog with mkdocs-material version 4.6.3 works fine. Probably because the instant feature has no effect there.

Expected behavior

Expected behavior is that the print dialog of the browser opens and I can configure the print settings.

Actual behavior

The print dialog opens and closes instantaneously. The print dialog works on any other side.

Steps to reproduce the bug

  1. Setup a completely new mkdocs project: mkdocs new my-project
  2. Modify the mkdocs.yml file the following:
site_name: My Docs
theme:
  name: material

theme:
  name: 'material'
  language: 'en'
  features:
    - instant
    - tabs
  1. Run mkdocs serve and open the page in your browser.
  2. Press Ctrl+P and the print dialog should open and close again directly.
  3. Use the following mkdocs.yml file instead:
site_name: My Docs
theme:
  name: material

theme:
  name: 'material'
  language: 'en'
  features:
    # - instant
    - tabs
  1. Run mkdocs serve and open the page in your browser.
  2. Press Ctrl+P and the print dialog should open.

Package versions

  • Python: python --version
Python 3.8.2
  • MkDocs: mkdocs --version
mkdocs, version 1.1 from c:\git\docs\venv\lib\site-packages\mkdocs (Python 3.8)
  • Material: pip show mkdocs-material | grep -E ^Version
Version: 5.1.1

Project configuration

site_name: My Docs
theme:
  name: material

theme:
  name: 'material'
  language: 'en'
  features:
    - instant
    - tabs

System information

  • OS: Windows 10
  • Browser: Chrome Version 81.0.4044.113 (Offizieller Build) (64-Bit)

Known Chrome Bug

I found a Chrome bug for that bug description: https://bugs.chromium.org/p/chromium/issues/detail?id=467976

The window.print() followed by window.close() is the same problem reported on the bug linked above.


Do you have any idea why this bug exists for the instant feature?
Which additional tests can I perform to narrow down the problem?

@squidfunk squidfunk added the bug Issue reports a bug label Apr 22, 2020
@squidfunk
Copy link
Owner

Nope, never seen it so far. Unfortunately, I'm currently a little short on time, so if somebody else can investigate, that'd be awesome!

@squidfunk
Copy link
Owner

I can't reproduce it on Chrome 81, macOS:

Ohne Titel

What's interesting is, that Chrome seems to reload the page before printing, which can be seen through the GitHub integration updating. Maybe someone encountering this issue can help narrow it down? I would suggest the following:

  1. Setup the development environment
  2. Enable instant loading and start development mode
  3. The whole instant loading code is located here, so maybe start by commenting out specific lines.

@squidfunk squidfunk added the needs reproduction Issue lacks a minimal reproduction .zip file label Apr 26, 2020
@ayeks
Copy link
Author

ayeks commented Apr 28, 2020

Thanks for trying to reproduce the bug. I experience the issue on Chromium Version 80.0.3987.163 (Offizieller Build) Built on Ubuntu , running on Ubuntu 18.04 (64-Bit) as well. So at least the bug exists on Windows and Ubuntu.

I setup the development environment as you described it and experience the problem there as well. Are you sure that you activated the instant feature in the mkdocs.yml when you tested it? By default it is commented out.

Unfortunately I have no experience in Javascript, so I am of no use here. :/

@squidfunk
Copy link
Owner

I definitely turned on instant loading, as you can see from the non-reloading GitHub stars integration.

@squidfunk
Copy link
Owner

I'm closing this, as nobody else seems to experience the problem, so it might be related to your setup. If somebody manages to isolate the problem and provide a reproducible case, we can, of course, fix it.

@squidfunk
Copy link
Owner

Finally reproducible and fixed in #2261!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug needs reproduction Issue lacks a minimal reproduction .zip file
Projects
None yet
Development

No branches or pull requests

2 participants