21

I was reading this question when I saw a bug with this comment:

Enter image description here

It is quite evident that the user who commented this included some code in his comment, but the comment just, well, overflowed.

Enter image description here

I am using Chrome 88 with Windows 10 (laptop).

The Chrome 88 version for Windows is supported. See: What browser version is supported?

Credit: @ErikA

10
  • It doesn't overflow for me. Which browser are you using? Is it supported? Commented Feb 22, 2021 at 11:20
  • Renders fine for me on FF on Mac Commented Feb 22, 2021 at 11:53
  • 2
    Cross-site duplicate of this post on MSO: Comment code format overflow covered by job. It’s a regression of Code in comment overflows. Commented Feb 22, 2021 at 17:04
  • 1
    Related: Inline code with lot of spaces overflow on the right side. Commented Jan 28, 2022 at 3:28
  • 1
    Related: Display bug on code block in comments Commented Apr 10, 2022 at 13:46
  • @justhalf not really "related". It's exactly the same bug. Nothing wrong, just saying. :-) Commented Apr 10, 2022 at 13:59
  • Yep, I'm just putting it there for additional duplicates that is targetting this. Hehe Commented Apr 10, 2022 at 14:14
  • @justhalf they're already listed, see in the right sidebar under "Linked". :-) Commented Apr 11, 2022 at 6:44
  • Is it listed there before I put the link here or after? I know that if I put a link to another question it will show up there. But not sure what other conditions it may appear (in this case the relevant one would be when the other question links here) Commented Apr 11, 2022 at 13:00
  • @justhalf yes the Linked Questions will always have the questions closed as duplicate of the current one. See here for example, this question that appears under "Linked Questions" isn't mentioned in any comment or answer, just closed as duplicate. Commented Apr 12, 2022 at 6:44

2 Answers 2

4

Update 2 - Adam reminded me that this was actually intentional per Why is double space replaced by single space when enclosed in backticks in comments?

Update

There are other reports this is still happening on modern browsers, so perhaps something to dive into more deeply.

Currently .code blocks in comments inherit the same white-space: pre-wrap; as code on the rest of the site. I wonder how folks would feel about removing some of the whitespace from code in comments?

.comment-text code { white-space: normal; }

comparison of whitespace being applied to code comments where it's removed in the after example


Original Answer

Sorry it's looking weird for you, but also our best advice is probably to update your browser.

Chrome 88 was released in January 2021. And comments do already have the following style applied:

ul.comments-list .comment-body {
    word-wrap: break-word;
}

Which should cause even long inline code in comments to wrap appropriately

The example comment containing long sections of code wrapping appropriately

Per the help section on What browsers do we support?, we only cover the latest two stable versions of major browsers:

List of supported browsers

Hopefully that at least sheds light on the tools we have and current support. If you do upgrade and are still experience the issue, feel free to comment back here or create a new post.

2
  • 2
    "removing some of the whitespace from code in comments" - sure, why not? Comments should not really hold any code to begin with, at least not anything more than e.g. "change varNameHere to varNameThere" Anything more substantial should be an edit or in chat. Commented Oct 29, 2024 at 14:45
  • Test ``` setInterval(function() { $.get("/unicoin/rock").done(function(obj) { $.post(["/unicoin/mine?rock=" + obj.rock], {fkey: "YOUR_USER_KEY"}); }); }, 15000); ``` Commented Nov 4, 2024 at 8:57
4

I don't think this is "fixed" at all.

My recent report (now mentioned in KyleMit's answer), showcasing that this is still happening on Chrome 129, a supported release, is clearly showing:

  1. That whitespace is retained / not squashed - good - I too think whitespace should be retained.
  2. That when whitespace is retained / not squashed, the right sidebar can easily be overflown - bad - why doesn't a sequence of whitespace wrap before overflowing the right sidebar? Why can't it just wrap half-way through?

I mean, I know it's just a cosmetic issue (further testing shows that it's not possible to force actual text out of view - which is great), but isn't the overflowing aspect exactly what's being reported in the question?

And, if so, how is stating that "this was actually intentional per Why is double space replaced by single space when enclosed in backticks in comments", as stated in KyleMit's answer, an answer to the problem?

The fact that the underlying reason why this happens is because inline code blocks have (rightfully) been changed so to not squash whitespace surely doesn't mean that overflowing the sidebar is intentional, does it? :|

But again, I know it's just a cosmetic issue, and I don't want to make a big fuss about it - if it's just too much to fix I could also agree with "so be it" as an answer - the only thing I disagree with is calling the issue something "intentional" or "fixed". It's certainly neither, and it's a "wontfix" at best (which, again, may be fine per se).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.