Skip to content

Commit 7bed3f4

Browse files
authored
fix: code scroll issue on small screen (#8445)
* fix: code scroll issue on small screen * fix: resolve horizontal scroll issue on small screens * fix: improve handling of horizontal scroll on small screens * fix: update overflow-wrap property for better code block handling
1 parent 8ab0fd7 commit 7bed3f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/rehype-shiki/src/transformers/twoslash/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
}
77

88
.twoslash-popup-code {
9-
max-width: 600px;
9+
max-width: min(600px, 90vw);
1010
display: block;
1111
width: fit-content;
1212
user-select: none;
13+
overflow-wrap: break-word;
1314
}
1415

1516
.twoslash-popup-code:not(:has(div)) {

packages/ui-components/src/Common/BaseCodeBox/index.module.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22

33
.root {
44
@apply w-full
5+
max-w-full
6+
overflow-x-hidden
57
rounded-sm
68
border
79
border-neutral-900
810
bg-neutral-950;
911

1012
.content {
1113
@apply m-0
14+
min-w-0
1215
p-4;
1316

1417
& > code {
1518
@apply font-ibm-plex-mono
1619
font-regular
1720
scrollbar-thin
1821
grid
22+
max-w-full
23+
[grid-template-columns:minmax(0,1fr)]
1924
overflow-x-auto
2025
bg-transparent
2126
p-0
@@ -27,7 +32,8 @@
2732
& > [class='line'] {
2833
@apply relative
2934
min-w-0
30-
pl-8;
35+
pl-8
36+
[overflow-wrap:break-word];
3137

3238
&:not(:empty:last-child)::before {
3339
@apply inline-block

0 commit comments

Comments
 (0)