GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bugfix: quote monospace font by tusharsadhwani · Pull Request #85 · python/python-docs-theme

Conversation

@tusharsadhwani

@tusharsadhwani tusharsadhwani commented Oct 7, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

For some reason, saying just monospace here doesn't seem to work on chrome mobile. Quoting monospace fixes the issue.

Before:

After:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@tusharsadhwani
Bugfix: quote monospace font
288d9aa
For some reason, saying just `monospace` here doesn't seem to work on chrome mobile. Quoting monospace fixes the issue.
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Oct 7, 2021
@nedbat

nedbat commented Oct 7, 2021

Copy link
Copy Markdown
Member

See https://twitter.com/sadhlife/status/1446060335979397120 for the sleuthing :)

hugovk reacted with hooray emoji tusharsadhwani reacted with heart emoji
All reactions
  • 🎉 1 reaction
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani
Another quote
5f66044
@hugovk

hugovk commented Oct 7, 2021

Copy link
Copy Markdown
Member

Good work! As it happens, this is fixed in the upcoming Chrome 96: python/pythondotorg#1708 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk
hugovk approved these changes Oct 7, 2021
View reviewed changes

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite the upcoming fix in Chrome, this is such a simple fix, I think it's worth merging for people who will still be on Chrome < 96, even after Chrome 96 release.

(Plus for people using latest Chrome 94 now :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JulienPalard

JulienPalard commented Oct 7, 2021

Copy link
Copy Markdown
Member

Oh this kind of bugs … ☹

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JulienPalard
JulienPalard merged commit 60d013d into python:master Oct 7, 2021
@JulienPalard

JulienPalard commented Oct 7, 2021

Copy link
Copy Markdown
Member

Thanks @tusharsadhwani and @nedbat!

hugovk and tusharsadhwani reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JulienPalard

JulienPalard commented Oct 7, 2021

Copy link
Copy Markdown
Member

I released it as python-docs-theme 2021-11 (I live in the future) and rebuilt https://docs.python.org/3/ so someone can check. Rebuild for other versions and languages will be automatically done in the next 24h.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@beauremus

beauremus commented Oct 7, 2021

Copy link
Copy Markdown

This "fix" broke the font for me. My Chrome on my Mac is now loading Helvetica for code rather than Courier. I can confirm that removing the quotes from monospace fixes the issue for me. I recommend this change be reverted and wait for a Chrome mobile fix. Let me know if I need to create a PR.

jstvz and lxnn reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

Chrome, showing 3 different behaviours on 3 operating systems. A tale as old as time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nedbat

nedbat commented Oct 7, 2021

Copy link
Copy Markdown
Member

Perhaps the best fix is to just specify monospace. Why a fallback to sans-serif? Does any browser not have a monospace font that is used when you specify monospace?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

Removing the quotes from monospace even with it being the only specified font breaks on current chrome mobile.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Oct 7, 2021

Copy link
Copy Markdown
Member

So... Do we need one monospace with quotes and one monospace without quotes? 🙃

Perhaps the best fix is to just specify monospace. Why a fallback to sans-serif? Does any browser not have a monospace font that is used when you specify monospace?

The problem seems to be desktop isn't picking up the "monospace" and falling back to sans-serif. If we remove sans-serif, it'll fall back to some system default, which will be some sans-serif or serif, but not monospace.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

Okay, I tested on 3.9's page, and it seems just

pre {
  font-family: monospace;
}

seems to work. Can someone test it on all 3 platforms, android mac and windows, that'd be great.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

Android, Chrome 94

Linux, Chrome 94
image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arseniiv

arseniiv commented Oct 7, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Noticed my Firefox 93.0 on win10 is weirded by "monospace" and falls back to sans-serif, though it underlines "monospace" in the style inspector as if it was used. Using font-family: "monospace", monospace, sans-serif; seems to work fine, though. Would this variant satisfy Chrome?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandon-leapyear

brandon-leapyear commented Oct 7, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨


Can confirm, currently fonts on docs.python.org are NOT monospaced on Chrome. font-family: "monospace", monospace, sans-serif does work.

tusharsadhwani reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

font-family: "monospace", monospace, sans-serif;

Can confirm, works fine. Even on mobile where just monospace, sans-serif doesn't.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Oct 7, 2021

Copy link
Copy Markdown
Member

There is (or was) a known problem with plain font-family: monospace; that can cause text resizing issues, see necolas/normalize.css#519 (comment). The workaround is font-family: monospace, monospace; or
font-family: monospace, anyotherfont;`

And necolas/normalize.css#519 (comment) suggests a reason, browsers looked for the fixed string font-family: monospace;

tusharsadhwani reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

Ah, that makes sense now. So I guess monospace, "monospace"; it is then :P

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@beauremus

beauremus commented Oct 7, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

MacOS Chrome 94 monospace
Screen Shot 2021-10-07 at 12 34 04 PM
MacOS Chrome 94 monspace, "monospace"
Screen Shot 2021-10-07 at 12 37 52 PM

Both solutions work for me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani

tusharsadhwani commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

@beauremus Thanks a bunch.

beauremus reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tusharsadhwani tusharsadhwani mentioned this pull request Oct 7, 2021
Fix monospace inconsistencies #87
Merged
@tusharsadhwani
tusharsadhwani deleted the patch-1 branch October 7, 2021 17:41
@ZedThree ZedThree mentioned this pull request Nov 1, 2022
Weird monospace bug #98
Closed
@hugovk hugovk mentioned this pull request Jan 31, 2023
Fix problem with monospace rendering in Vivaldi #104
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@tusharsadhwani @nedbat @hugovk @JulienPalard @beauremus @arseniiv @brandon-leapyear @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.