Skip to content

Commit a3ac971

Browse files
fix (Layout) mobile responsiveness + scrollbar styling (#15581)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR * Code blocks were overflowing which made content overflow making for a poor mobile experience | Before | After | | -------|--------| | <img width="430" height="746" alt="CleanShot 2025-11-20 at 10 39 38" src="https://github.com/user-attachments/assets/3581590d-236f-47c1-9dd0-c630ad77a27f" /> | <img width="510" height="861" alt="CleanShot 2025-11-20 at 10 39 59" src="https://github.com/user-attachments/assets/b054b311-736e-4e48-a9be-d3c0d5180f5c" /> | * Scrollbars looked janky on mobile | Before | After | |--------|--------| | <img width="761" height="209" alt="CleanShot 2025-11-20 at 10 35 46" src="https://github.com/user-attachments/assets/df8719f7-7ea0-4fbb-bcfb-69dfa4ee03d5" /> | <img width="538" height="280" alt="CleanShot 2025-11-20 at 10 35 10" src="https://github.com/user-attachments/assets/5961d2f5-c9be-4ab2-bed5-c88fefe3a5f4" /> | | <img width="764" height="199" alt="CleanShot 2025-11-20 at 10 35 36" src="https://github.com/user-attachments/assets/6fac5293-61c6-4c76-8392-58b36d47ba44" /> | <img width="518" height="279" alt="CleanShot 2025-11-20 at 10 35 20" src="https://github.com/user-attachments/assets/10fa747f-4ccb-479c-acf5-2266ae79ce7f" /> | ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 86d2c6c commit a3ac971

File tree

4 files changed

+102
-3
lines changed

4 files changed

+102
-3
lines changed

src/components/codeBlock/code-blocks.module.scss

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.code-block {
2+
position: relative;
3+
24
& ::selection {
35
background-color: rgba(106, 95, 193, 0.5);
46
}
@@ -12,6 +14,7 @@
1214
white-space: pre;
1315
overflow-x: auto;
1416
max-width: 100%;
17+
box-sizing: border-box;
1518
tab-size: 2;
1619
}
1720

@@ -28,6 +31,37 @@
2831
/* Use horizontal scroll instead of wrapping */
2932
white-space: pre;
3033
overflow-x: auto;
34+
box-sizing: border-box;
35+
36+
/* Custom scrollbar styling to match code block theme */
37+
/* Firefox */
38+
scrollbar-width: thin;
39+
scrollbar-color: rgba(148, 129, 164, 0.4) transparent;
40+
41+
/* WebKit (Chrome, Edge, Safari) */
42+
&::-webkit-scrollbar {
43+
width: 8px;
44+
height: 8px;
45+
}
46+
47+
&::-webkit-scrollbar-track {
48+
background: transparent;
49+
}
50+
51+
&::-webkit-scrollbar-thumb {
52+
background-color: rgba(148, 129, 164, 0.4);
53+
border-radius: 9999px;
54+
border: 2px solid transparent;
55+
background-clip: content-box;
56+
}
57+
58+
&:hover::-webkit-scrollbar-thumb {
59+
background-color: rgba(148, 129, 164, 0.6);
60+
}
61+
62+
&::-webkit-scrollbar-thumb:active {
63+
background-color: rgba(148, 129, 164, 0.8);
64+
}
3165
}
3266

3367
/**
@@ -107,6 +141,26 @@
107141
margin-left: -12px;
108142
width: calc(100% + 12px);
109143
}
144+
145+
overflow-y: visible; /* Allow copy button above to be visible */
146+
147+
/* Mobile responsive styles for screens smaller than 768px */
148+
@media (max-width: 768px) {
149+
overflow-x: hidden; /* Prevent container from scrolling */
150+
151+
pre {
152+
-webkit-overflow-scrolling: touch;
153+
}
154+
155+
/* Adjust diff highlighting for mobile - prevent overflow */
156+
:global(.diff-inserted),
157+
:global(.inserted),
158+
:global(.diff-deleted),
159+
:global(.deleted) {
160+
width: 100%;
161+
margin-left: 0;
162+
}
163+
}
110164
}
111165

112166
.code-actions {
@@ -119,6 +173,8 @@
119173
margin: 0 0.25rem;
120174
right: 0;
121175
top: -35px;
176+
white-space: nowrap;
177+
max-width: calc(100% - 0.5rem);
122178
}
123179

124180
.filename {

src/components/codeTabs.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,37 @@ export function CodeTabs({children}: CodeTabProps) {
126126
<Container ref={containerRef}>
127127
{showSigninNote(codeBlocks[selectedTabIndex]) && <SignInNote />}
128128
<TabBar>{buttons}</TabBar>
129-
<div className="relative" data-sentry-mask>
130-
{codeBlocks[selectedTabIndex]}
131-
</div>
129+
<CodeBlockWrapper data-sentry-mask>{codeBlocks[selectedTabIndex]}</CodeBlockWrapper>
132130
</Container>
133131
);
134132
}
135133

136134
const Container = styled('div')`
135+
position: relative;
136+
overflow-y: visible; /* Allow copy button to be visible */
137+
137138
pre[class*='language-'] {
138139
padding: 10px 12px;
139140
border-radius: 0 0 6px 6px;
140141
border: 1px solid var(--accent-11);
141142
border-top: none;
142143
}
144+
145+
@media (max-width: 768px) {
146+
width: 100%;
147+
max-width: 100%;
148+
overflow-x: hidden;
149+
}
150+
`;
151+
152+
const CodeBlockWrapper = styled('div')`
153+
position: relative;
154+
155+
@media (max-width: 768px) {
156+
width: 100%;
157+
max-width: 100%;
158+
overflow-x: hidden;
159+
}
143160
`;
144161

145162
const TabBar = styled('div')`
@@ -151,6 +168,10 @@ const TabBar = styled('div')`
151168
align-items: center;
152169
padding: 0 0.5rem;
153170
border-radius: 6px 6px 0 0;
171+
width: 100%;
172+
box-sizing: border-box;
173+
overflow: hidden; /* Prevent any scrollbars */
174+
flex-wrap: nowrap; /* Prevent tabs from wrapping */
154175
`;
155176

156177
const TabButton = styled('button')`
@@ -163,6 +184,8 @@ const TabButton = styled('button')`
163184
background: none;
164185
outline: none;
165186
border-bottom: 3px solid transparent;
187+
white-space: nowrap;
188+
flex-shrink: 0;
166189
167190
&:focus,
168191
&[data-active='true'] {

src/components/docPage/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ export function DocPage({
134134
max-width: none;
135135
box-sizing: border-box;
136136
}
137+
/* Mobile responsive styles */
138+
@media (max-width: 768px) {
139+
.main-content {
140+
width: 100%;
141+
max-width: 100%;
142+
overflow-x: hidden;
143+
}
144+
#doc-content {
145+
width: 100%;
146+
max-width: 100%;
147+
overflow-x: hidden;
148+
}
149+
}
137150
/* At toc breakpoint (1490px), constrain content to leave room for TOC */
138151
@media (min-width: 1490px) {
139152
#doc-content {

src/components/docPage/type.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
--heading-color: var(--darkPurple);
1212
--link-decoration: none;
1313
--code-background: #251f3d;
14+
15+
@media (max-width: 768px) {
16+
width: 100%;
17+
max-width: 100%;
18+
overflow-x: hidden;
19+
}
20+
1421
h1,
1522
h2,
1623
h3,

0 commit comments

Comments
 (0)