Skip to content

Commit d741b32

Browse files
committed
Ensure body.scrollHeight matches the visible content height
The consent form's scrollable .content div (with overflow-y: auto and a scrollHeight of 1984px) was inflating body.scrollHeight to 2026px, even though the visible content was only 1314px. - Made html the scroll container (overflow-y: auto) instead of body - Set body to overflow-y: visible and height: fit-content so it matches visible content only - Added contain: layout style to the consent form content to isolate its scrollable area
1 parent f05982c commit d741b32

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/app/globals.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,12 @@
183183
color-scheme: light;
184184
}
185185

186-
/* We don't have a dark theme... yet */
187186
[data-theme='dark'] {
188187
--background: #ffffff;
189188
--foreground: #171717;
190189
color-scheme: dark;
191190
}
192191

193-
/* Default to system preference before JS loads */
194192
@media (prefers-color-scheme: dark) {
195193
:root:not([data-theme]) {
196194
--background: #ffffff;
@@ -199,13 +197,17 @@
199197
}
200198
}
201199

202-
html,
203-
body {
200+
html {
204201
max-width: 100vw;
205202
overflow-x: hidden;
203+
overflow-y: auto;
206204
}
207205

208206
body {
207+
max-width: 100vw;
208+
overflow-x: hidden;
209+
overflow-y: visible;
210+
height: fit-content;
209211
color: var(--foreground);
210212
background: var(--background);
211213
font-family: var(--Font-Family-Product);

src/app/layout.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
background-size: cover;
2424
background-position: top center;
2525
background-repeat: no-repeat;
26+
background-attachment: scroll;
2627
font-family: var(--Font-Family-Product);
2728
position: relative;
2829
}

src/components/consent-form/consent-form.module.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
.link {
4444
color: var(--sds-color-palette-blue-60);
45-
/* Inherit all other styles from parent paragraph */
4645
font-family: inherit;
4746
font-size: inherit;
4847
font-style: inherit;
@@ -77,10 +76,10 @@
7776
width: 100%;
7877
max-width: 100%;
7978
box-sizing: border-box;
79+
contain: layout style;
8080

8181
.section {
8282
flex: 1 1 0%;
83-
/* Use 0% basis for proper flex behavior */
8483
min-width: 0;
8584
max-width: 100%;
8685
box-sizing: border-box;
@@ -94,7 +93,6 @@
9493
line-height: 24px;
9594
margin-block: 1em;
9695
overflow-wrap: break-word;
97-
/* Wrap long words at word boundaries when necessary */
9896
max-width: 100%;
9997
box-sizing: border-box;
10098
}
@@ -133,7 +131,6 @@
133131
background-color: white;
134132
border: 2px solid #e0e0e0;
135133
color: #212121;
136-
/* Override primary button text color for cancel button */
137134
}
138135

139136
.cancelButton:hover {

0 commit comments

Comments
 (0)