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

interactive examples: line numbers and code overlaps #976

Closed
cjarmada opened this issue May 2, 2022 · 14 comments
Closed

interactive examples: line numbers and code overlaps #976

cjarmada opened this issue May 2, 2022 · 14 comments

Comments

@cjarmada
Copy link

cjarmada commented May 2, 2022

Summary

Sometimes the line numbers of interactive examples overlap with the code.

Details

See this comment.

See also

Original description by @cjarmada

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

What specific section or headline is this issue about?

Array.prototype.concat()

What information was incorrect, unhelpful, or incomplete?

the demo is altered/bug

What did you expect to see?

a structured explanation

Do you have any supporting links, references, or citations?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label May 2, 2022
@wbamberg

This comment was marked as outdated.

@cjarmada

This comment was marked as outdated.

@hamishwillee

This comment was marked as outdated.

@wbamberg
Copy link
Collaborator

wbamberg commented May 2, 2022

I can't find the report now, but I wonder if this is an intermittent issue we see in interactive examples where the line numbers overlap the first couple of characters of the code. It turns out I can reproduce this in Chrome if I:

Screen Shot 2022-05-02 at 4 48 14 PM

@cjarmada , is this what you are seeing?

This has been reported before but was closed because noone could figure out what was causing it.

But if this is your problem I think we should transfer this issue to Yari, so we can have another go at fixing it!

@wbamberg
Copy link
Collaborator

wbamberg commented May 2, 2022

No wonder I couldn't find it, it was from Kuma days: mdn/kuma#6310.

@cjarmada
Copy link
Author

cjarmada commented May 3, 2022 via email

@wbamberg wbamberg transferred this issue from mdn/content May 3, 2022
@wbamberg wbamberg changed the title altered letters and numbers interactive examples: line numbers and code overlaps May 3, 2022
@wbamberg
Copy link
Collaborator

wbamberg commented May 3, 2022

Great! Since this is a platform issue, I'm transferring it to mdn/yari.

@cjarmada
Copy link
Author

cjarmada commented May 3, 2022

Screenshot (83)

And if I refresh the page, it's just fixed.

Screenshot (85)

@caugner
Copy link
Contributor

caugner commented May 3, 2022

Unfortunately I cannot reproduce the issue following those steps with Chrome 101 on Mac OS.

@cjarmada @wbamberg

  • What Chrome version and operating system are you using?
  • Could you please provide a screen recording (video) starting with a blank page (about:blank) so that we can see exactly what steps lead to the issue?

@caugner caugner added interactive-examples and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels May 3, 2022
@caugner
Copy link
Contributor

caugner commented May 3, 2022

Duplicate of #742.

@wbamberg
Copy link
Collaborator

wbamberg commented May 3, 2022

I'm running macOS Big Sur, and see the problem with Chrome 100 (but since this has been an issue for years, it's unlikely to be a problem with a specific Chrome version).

Screen recording:

overlaps

@caugner
Copy link
Contributor

caugner commented May 3, 2022

Thanks @wbamberg! I was able to reproduce it now, but only after disabling MDN Offline.

It looks like a CodeMirror bug, which doesn't set the width of the div.CodeMirror-linenumber:

image

And there are indeed two corresponding upstream bugs:

@schockocraft
Copy link

schockocraft commented Sep 21, 2022

I am using this script in Tampermonkey now, to fix the issue on my end, and thought it might be worth suggesting that you'll implement the same workaround for everyone until the upstream issues have been resolved:

gist.github.com/schockocraft/mdn-fix-js-code-examples.js

If you don't wanna do this, i hope anyone who is annoyed by it will find the link here to use it for themselfes :D

@NiedziolkaMichal
Copy link
Member

This issue has been fixed, after updating CodeMirror to version 6. Thank you for reporting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants