stdlib-js / www

Website for stdlib, a standard library for JavaScript and Node.js.
https://stdlib.io
Apache License 2.0
6 stars 8 forks source link

[Bug]: printing should always be done in "light" mode #49

Closed kgryte closed 2 years ago

kgryte commented 2 years ago

Currently, if a user tries to print package documentation, the rendered docs use the current theme. Hence, if in dark mode, the print document will also be in dark mode. This is likely not desired (e.g., imagine printing 10 pages with black backgrounds).

Presumably, the fix here is to always switch the application to "light" mode, generate the print docs, and then revert to theme back to its original value before printing.

Planeshifter commented 2 years ago

Hmm, that shouldn't be the case, see https://github.com/stdlib-js/www/blob/c3d227a0eb8a0f2db66a429c61cb40e9d324a7e6/src/components/readme/print_button.jsx#L85

For me, printing via the button does indeed switch to light mode and then back?

Planeshifter commented 2 years ago

This should also already work when directly invoking the print dialog window (e.g., via Ctrl + P on Chrome).

kgryte commented 2 years ago

I did this on mobile (iOS Safari), so maybe it only happens there?

kgryte commented 2 years ago

IMG_3235

Planeshifter commented 2 years ago

Cannot reproduce myself: Has worked on all my browsers on laptop, Android phone, and on an iPad on Safari / Chrome.

Judging from above screenshot, formatting is also off with no left margin.

kgryte commented 2 years ago

Not able to reproduce on MacOS Safari.

Planeshifter commented 2 years ago

Is this an older iPhone? Per MDN, beforeprint has been supported in Safari since v13 (see: https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeprint_event).

kgryte commented 2 years ago

It is an older iPhone. Not sure what Safari version it's running though.

kgryte commented 2 years ago

Ah...seems as though the Safari version should match the iOS version. I am on iOS 12.5.5, so don't have beforeprint support, it seems.

kgryte commented 2 years ago

Given that users are unlikely to want to print on mobile devices, especially older iOS devices, I'll close this out.

Planeshifter commented 2 years ago

Yeah, Apple doesn't provide updates for their browsers on older devices. Starting with version 13, things work: print_color

kgryte commented 2 years ago

Thanks for checking!

kgryte commented 2 years ago

I also noticed various other rendering issues when viewing the stdlib docs on my phone, and I'm wondering if some of them are just due to it being an older Safari version.