Skip to content

Commit 0b8c63d

Browse files
authored
report: fix sticky table header in DevTools (#14766)
1 parent e6e8f5a commit 0b8c63d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

report/assets/styles.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
--sparkline-height: 5px;
146146
--stackpack-padding-horizontal: 10px;
147147
--sticky-header-background-color: var(--report-background-color);
148+
--sticky-header-buffer: calc(var(--topbar-height) + var(--sticky-header-height));
148149
--sticky-header-height: calc(var(--gauge-circle-size-sm) + var(--score-container-padding) * 2);
149150
--table-higlight-background-color: hsla(210, 17%, 77%, 0.1);
150151
--tools-icon-color: var(--color-gray-600);
@@ -284,6 +285,7 @@
284285
.lh-container:not(.lh-topbar + .lh-container) {
285286
--topbar-height: 0;
286287
--sticky-header-height: 0;
288+
--sticky-header-buffer: 0;
287289
}
288290

289291
.lh-devtools.lh-root {
@@ -296,6 +298,8 @@
296298
.lh-devtools .lh-container {
297299
overflow-y: scroll;
298300
height: calc(100% - var(--topbar-height));
301+
/** The .lh-container is the scroll parent in DevTools so we exclude the topbar from the sticky header buffer. */
302+
--sticky-header-buffer: calc(var(--sticky-header-height));
299303
}
300304
@media print {
301305
.lh-devtools .lh-container {
@@ -1414,8 +1418,7 @@
14141418
max-width: var(--report-content-max-width);
14151419
margin: 0 auto;
14161420

1417-
--topbar-plus-sticky-header: calc(var(--topbar-height) + var(--sticky-header-height));
1418-
scroll-margin-top: var(--topbar-plus-sticky-header);
1421+
scroll-margin-top: var(--sticky-header-buffer);
14191422

14201423
/* Faster recalc style & layout of the report. https://web.dev/content-visibility/ */
14211424
content-visibility: auto;
@@ -1510,7 +1513,7 @@
15101513

15111514
.lh-table thead th {
15121515
position: sticky;
1513-
top: calc(var(--topbar-plus-sticky-header) + 1em);
1516+
top: calc(var(--sticky-header-buffer) + 1em);
15141517
z-index: 1;
15151518
background-color: var(--report-background-color);
15161519
border-bottom: 1px solid var(--report-border-color-secondary);

report/renderer/components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)