Skip to content

Commit d65b2a4

Browse files
committed
Chore: Style clean up, add comments
1 parent 4ad22e6 commit d65b2a4

File tree

1 file changed

+5
-9
lines changed
  • packages/components/src/styles/components/code-block

1 file changed

+5
-9
lines changed

packages/components/src/styles/components/code-block/index.scss

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,6 @@ $hds-code-block-code-footer-height: 48px;
250250
}
251251
}
252252
}
253-
254-
// Ensures the line numbers are always on top of the footer gradient
255-
&.hds-code-block--has-overlay-footer {
256-
.line-numbers-rows {
257-
z-index: 1;
258-
isolation: isolate;
259-
}
260-
}
261253
}
262254

263255
// Highlighted Lines
@@ -313,6 +305,9 @@ $hds-code-block-code-footer-height: 48px;
313305
}
314306
}
315307

308+
// Usage of sticky positioning, negative margins, and z-index are required to prevent styling issues
309+
// when horizontal scrolling is present.
310+
// https://hashicorp.slack.com/archives/C025N5V4PFZ/p1746659338984369
316311
.hds-code-block--has-overlay-footer {
317312
.hds-code-block__code::after {
318313
// gradient element
@@ -321,7 +316,7 @@ $hds-code-block-code-footer-height: 48px;
321316
left: 0;
322317
display: block;
323318
height: $hds-code-block-code-footer-height;
324-
margin: 0 0 -#{$hds-code-block-code-padding} -1000px;
319+
margin: 0 0 -#{$hds-code-block-code-padding} -1000px; // cover line highlights when line numbers are enabled
325320
background: linear-gradient(360deg, #0d0e12 37.07%, rgba(13, 14, 18, 25%) 100%);
326321
content: "";
327322
pointer-events: none;
@@ -331,6 +326,7 @@ $hds-code-block-code-footer-height: 48px;
331326
padding-bottom: $hds-code-block-code-footer-height;
332327
}
333328

329+
// place line numbers on top of footer gradient
334330
.line-numbers-rows {
335331
z-index: 1;
336332
isolation: isolate;

0 commit comments

Comments
 (0)