Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Comments on Some code blocks extend into the right hand panel on desktop

Parent

Some code blocks extend into the right hand panel on desktop

+4
−0

If a code block contains a line too long to fit in the available horizontal space, the excess to the right is hidden, with a scroll bar to allow seeing the rest (this is a good thing):

Raw text:

```text
This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
```

Rendered result:

This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.

Summary section of a details section

However, if a code block is contained within a <details> section's <summary> section, the long line instead continues across the page to the right, obscuring the right hand panel:

Raw text:

<details>
<summary>

```text
This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
```

</summary>

```text
This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
```

</details>

Rendered result (looks fine in the editor preview):

This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.

If you are viewing on mobile, or a narrow desktop view (resized window or zoomed in content) the problem will not occur, so here's a screenshot:

Code block in the summary section extending into the right hand panel and beyond

Note that expanding the details section shows that the content revealed correctly has a scrollbar. Only the summary section continues across the page beyond the right hand edge of the post.

Quote block inside the summary of a details section

This problem does not show up while editing a post, so the poster has no way of knowing that it will happen until they have already saved the post. They may not notice until the next time they view their post.

There is a similar problem that does show up while editing the post:

If a code block is contained within a quote block within a <details> section's <summary> section, the long line continues across the page to the right even in the edit preview (you can see the difference between this example and the previous one by pressing "Suggest Edit" below this post):

Raw text:

<details>
<summary>

> ```text
> This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
> ```

</summary>

> ```text
> This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
> ```

</details>

Rendered result (broken even in the editor preview):

This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.
This is an exceptionally long line for the purpose of demonstrating what happens when the right hand side exceeds the available horizontal space.

Note that again the content revealed correctly has a scrollbar.

Mobile and narrow desktop view

In a window narrower than 780 pixels, which covers most mobile browsers and also desktop browsers where the window has been resized or zoomed in, the problem does not occur. All of the examples above look fine, both in the editor preview and the saved post. This makes it easier for someone to create a post with this problem without realising it.

This may also hint at a solution, for anyone investigating how to fix this.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Bug not presents in the preview during editing and on mobile. (4 comments)
Post
+1
−1

Code blocks are for showing source code, where lines must be shown as written. Wrapping could change the meaning. Long lines in code blocks must be shown as long lines. The best the system can do is provide a horizontal scroll bar. It looks like it is, so I don't see the problem.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

2 comment threads

If I understood the original post correctly, trichoplax does not consider the use of a scroll-bar for... (6 comments)
Note this answer was before I clarified the bug report (1 comment)
If I understood the original post correctly, trichoplax does not consider the use of a scroll-bar for...
AdminBee‭ wrote 10 months ago

If I understood the original post correctly, trichoplax does not consider the use of a scroll-bar for showing over-long lines in code-blocks as the problem. Rather, they consider it a bug that this scroll-bar is not added as it should when the over-long code-block is inside the summary section of a details block.

Olin Lathrop‭ wrote 10 months ago

AdminBee‭ Then the title needs to be fixed. That was certainly not clear from a quick skim. The point seemed to be about long lines, not lacking scroll bars.

trichoplax‭ wrote 10 months ago

If skimming through the post didn't look immediately awful, I'm wondering if you are viewing on mobile, where I've just been informed the problem does not exist. On desktop the expandable details section has a summary which is a code block stretching out and partly obscuring the right hand side panel.

I'm about to edit to mention mobile and narrow desktop views. I'll see if I can make the title clearer at the same time, as I can see how this would be misleading for people reading this on mobile.

trichoplax‭ wrote 10 months ago

I absolutely agree that horizontal scroll bars are the solution. Thanks for highlighting that the title and opening paragraph suggested the opposite.

I have now edited to make the title mention the right hand panel, to mention in the first paragraph that scroll bars are a good thing, and added a screenshot since I now understand that the problem does not occur for all viewers.

Olin Lathrop‭ wrote 10 months ago

trichoplax‭ I only access Codidact from a desktop. The issue is that I didn't read everything in your post. I read the title and looked at some of your example, and they all seemed to have scroll bars. I didn't notice that the two very long lines you show didn't have scroll bars, as that didn't seem to be the point of the post according to the title.

trichoplax‭ wrote 10 months ago · edited 10 months ago

I'll make sure I focus more on the title and introduction from now on.