ui : fix attachment text preview clipped when a line is longer than the container (#30806)

In the attachment preview, SyntaxHighlightedCode's wrapper (overflow-auto) was not the element that ended up owning horizontal overflow: the inner code box kept its content clipped at the wrapper's width, so a single line longer than the preview pane was cut off with no scrollbar (scrollWidth == clientWidth while the code's own content measured tens of thousands of px).

Give the pre/code boxes their intrinsic width (width: max-content, min-width: 100%) so long-line overflow propagates to the scrolling wrapper. Verified in the running WebUI: with a 6000-char line, wrapper scrollWidth goes from 990 (clipped, unscrollable) to 50449 with a working horizontal scrollbar; short content still fills the container exactly as before (min-width: 100%).

Fixes #30796
This commit is contained in:
A-Raphie
2026-10-19 23:22:14 +01:00
committed by GitHub
parent 4c3c5810f8
commit ab7ed0d4b5
@@ -147,12 +147,19 @@
.code-preview-wrapper pre {
background: transparent;
padding: 0;
/* Stretch to the content's intrinsic width so a single long line
propagates its overflow to this scrolling wrapper instead of being
clipped at the wrapper's width with no way to scroll to it. */
width: max-content;
min-width: 100%;
}
.code-preview-wrapper code {
background: transparent;
display: block;
padding: 0.5rem;
width: max-content;
min-width: 100%;
}
:global(.dark) .code-preview-wrapper {