Problem/Motivation

When displaying php code using "pre" tag as content in an article, long lines are not fully displayed (see SOLO_pre.png) because no horizontal scroll bar appears as applies in the Olivero theme (see OLIVER_pre.pg)

Steps to reproduce

Create a new article with Full HTML text source. Switch to source and paste some code between "pre" tags which is wider than the content block space. (Sorry, can't supply sample because the issue posting page processes it.)

Save the article and see that the code line is not fully displayed. The full line is still viewable in edit mode.

Proposed resolution

CSS to display scroll bar. Maybe something like overflow-x: scroll;

Remaining tasks

User interface changes

API changes

Data model changes

Comments

peterk900 created an issue. See original summary.

flashwebcenter’s picture

Status: Active » Needs review

Hello Peter,

I added some css to dev version. You can download it and test now.
It adds a horizontal scrollbar to pre so long code lines display correctly, like in Olivero.

Please let me know if it works as expected on your side.
Thanks!

peterk900’s picture

Thanks for responding so quickly. But sadly using the dev version (solo:1.0.x-dev@dev) doesn't display a scroll bar with sample content which, when switched back to Olivero, stops boundary overlap by displaying a horizontal scroll bar.

flashwebcenter’s picture

StatusFileSize
new280.46 KB
new216.8 KB

Hello,
I attached two screenshots and included a live example using the same code.

Solo
Olivero
When comparing Olivero and Solo:

If the code is inside a pre tag only, Solo shows horizontal scrolling while Olivero does not.
If the code is wrapped in both pre and code tags, then both Solo and Olivero show horizontal scrolling.

The actual scrollbar visibility is controlled by the browser and operating system, which use overlay scrollbars that may only appear on hover or while scrolling. The theme only controls whether the content is scrollable, not whether the scrollbar is always visible.

Please let me know if you are seeing the same behavior on your side, or if you are experiencing something different.

Best wishes,
Alaa

peterk900’s picture

StatusFileSize
new457.2 KB

Thanks for your further work and explanations on this. I think my last post, saying your code changes didn't work, referred to viewing code on a page displaying the full node not a front page teaser display. Of the two, correct display of the full node is the more important.

All work relates to code tags enclosed with pre tags.

Attached is a .pdf showing some screen shots. In summary, long code lines invoke a scroll bar when displayed in a teaser list but this doesn't work for me when I view the full node. With Olivero, it seems the other way around, full node displays with scroll bars but a teaser list puts the scroll bar at the bottom of the page.

My normal browser is Firefox, but I carried out tests in Chrome and Edge with the same results.

I hope this is useful. What I thought might be a simple issue is, I now realise, rather more complicated! If I've missed the point on something, please let me know.

Thanks again.
Peter

PS I've added an extract of the page source when displaying a full node where no scrollbar appears.

peterk900’s picture

StatusFileSize
new70.63 KB
flashwebcenter’s picture

Hello,

Thank you for the PDFs and the detailed explanation. Based on the two files you shared, this looks like a caching or deployment issue. Since the teaser view is working correctly, it suggests that the updated code is present in some places but not others.

Could you please check whether this file exists on your site?
"../web/themes/contrib/solo/css/components/solo-text-content.css"

If this file is present, then the new code is already in place.
The CSS in this file does not target specific view modes. Instead, it applies to any pre or code elements inside:

  • .field--type-text-long code
  • .field--type-text-with-summary code
  • .cke_editable code
  • .ck-content

In the second PDF you sent, the element includes the class .field--type-text-with-summary, so the CSS should apply there. The live example I shared in my previous message also demonstrates this on a full node view.

Please let me know whether the CSS file exists on your site, and we can continue from there.

Best regards,
Alaa

peterk900’s picture

Thanks again.
The css fle exists in the location you specify.
I've attached more css for the same content on pages where scroll bars appear and where they don't. The css seems identical. Interestingly both samples have the line $view_mode = 'teaser'; Strange because the second set of CSS relates to full node display node.
Hope this helps.
Peter

flashwebcenter’s picture

Hello,

Thank you for the PDF.

Based on what you’re seeing, this looks like a page-level conflict (it could be coming from another stylesheet, a layout wrapper, or an element applying overflow/width rules). I added the exact same markup from your PDF to my example page and it works correctly on my side.

If you can share a link to the affected page (even a temporary one), I can inspect it and try to pinpoint what is overriding the expected behavior.

In the meantime, please try injecting the CSS below and let me know if the horizontal scroll starts working:

#page-wrapper .field--type-text-with-summary pre {
  max-inline-size: 100%;
  overflow-y: hidden;
  overflow-x: auto !important;
  white-space: pre !important;
}

#page-wrapper .field--type-text-with-summary pre code {
  min-inline-size: 100%;
  display: inline-block;
  overflow-x: auto !important;
  white-space: pre !important;
}

Please let me know whether the horizontal (auto) scroll works after this change.

Best wishes,
Alaa

peterk900’s picture

Hi Alaa

I tried the new CSS but it doesn't solve the problem.

Here's a link to a site with the revised Solo theme which shows the sample posts causing the problem.

Thank you continuing to try to resolve this.

Peter

flashwebcenter’s picture

StatusFileSize
new433.85 KB

Hello Peter,

Not sure what you mean here. If you are saying the page does not scroll, the link you sent is working correctly. I can see both the code you added and the code in the theme.

If you are referring to the visibility of the scrollbar, this is controlled by the operating system. On both macOS and Windows, scrollbars can be hidden by default and only appear while scrolling. I had to change this setting on my Mac to always show them, and Windows has a similar option.

Hopefully this helps.
Scroll

Best wishes,
Alaa

peterk900’s picture

Thanks.

The scroll bars appear when a list of teasers appear but not when you click the more link and view the full node. This is a problem for both articles but is most noticeable for the second with the long lines where all content is not viewable. Olivero correctly displays scroll bars when viewing the whole node, but - interestingly - not in teaser mode. Sorry if I didn't make this clear.

Peter

flashwebcenter’s picture

Hello Peter,

Thanks for your patience and for the detailed report and link. I’ve identified the issue and pushed a CSS fix to the dev version.
Please download and test it when you can, and let me know if the problem persists.

Best wishes,
Alaa

peterk900’s picture

The changes you have made work perfectly! Thank you for your determination to resolve a problem which will probably affect very few Solo users.
Best wishes
Peter

flashwebcenter’s picture

Category: Support request » Bug report
Status: Needs review » Fixed

You are very welcome!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.