Skip to content

Commit a4f226f

Browse files
authored
fix(Header): Fix sticky header position in Grafana v11.3+ (#218)
1 parent 71d133c commit a4f226f

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

Dockerfile.plugin.e2e

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM mcr.microsoft.com/playwright:v1.47.1
1+
FROM mcr.microsoft.com/playwright:v1.48.0
22

33
WORKDIR /app
44

55
# required by the e2e test code
6-
RUN yarn add "@playwright/test@^1.47.1" "dotenv@^16.3.1"
6+
RUN yarn add "@playwright/test@^1.48.0" "dotenv@^16.3.1"
77

88
ENV E2E_BASE_URL="http://localhost:3000"
99

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@grafana/e2e-selectors": "^10.0.0",
6868
"@grafana/eslint-config": "^7.0.0",
6969
"@grafana/tsconfig": "^1.2.0-rc1",
70-
"@playwright/test": "^1.47.1",
70+
"@playwright/test": "^1.48.0",
7171
"@swc/core": "^1.3.51",
7272
"@swc/helpers": "^0.5.0",
7373
"@swc/jest": "^0.2.23",

src/pages/ProfilesExplorerView/components/SceneProfilesExplorer/SceneProfilesExplorer.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { css } from '@emotion/css';
22
import { dateMath, GrafanaTheme2 } from '@grafana/data';
3+
import { useChromeHeaderHeight } from '@grafana/runtime';
34
import {
45
EmbeddedSceneState,
56
getUrlSyncManager,
@@ -439,7 +440,8 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
439440
};
440441

441442
static Component({ model }: SceneComponentProps<SceneProfilesExplorer>) {
442-
const styles = useStyles2(getStyles); // eslint-disable-line react-hooks/rules-of-hooks
443+
const chromeHeaderHeight = useChromeHeaderHeight(); // eslint-disable-line react-hooks/rules-of-hooks
444+
const styles = useStyles2(getStyles, chromeHeaderHeight ?? 0); // eslint-disable-line react-hooks/rules-of-hooks
443445
const { data, actions } = model.useProfilesExplorer();
444446

445447
const {
@@ -516,11 +518,11 @@ export class SceneProfilesExplorer extends SceneObjectBase<SceneProfilesExplorer
516518
}
517519
}
518520

519-
const getStyles = (theme: GrafanaTheme2) => ({
521+
const getStyles = (theme: GrafanaTheme2, chromeHeaderHeight: number) => ({
520522
header: css`
521523
background-color: ${theme.colors.background.canvas};
522524
position: sticky;
523-
top: 0;
525+
top: ${chromeHeaderHeight}px;
524526
z-index: 1;
525527
`,
526528
controls: css`

yarn.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,14 +2168,14 @@ __metadata:
21682168
languageName: node
21692169
linkType: hard
21702170

2171-
"@playwright/test@npm:^1.47.1":
2172-
version: 1.47.1
2173-
resolution: "@playwright/test@npm:1.47.1"
2171+
"@playwright/test@npm:^1.48.0":
2172+
version: 1.48.0
2173+
resolution: "@playwright/test@npm:1.48.0"
21742174
dependencies:
2175-
playwright: "npm:1.47.1"
2175+
playwright: "npm:1.48.0"
21762176
bin:
21772177
playwright: cli.js
2178-
checksum: 10/d26656451cbd4cbb865c6acb25958a25171b3714907e1595301f21655b1be8f521dbd2197eecfa5b34325626c94b8ab535b8571478880633679e63ebfb6775b9
2178+
checksum: 10/8845ed0f0b303e10ee0a0f04562ef83be3f9123fac91d722f697ad964a119af74cd5fb08e1139f1b20b27396479456c984bfdc699fadedd92af9c0490fb4c7c0
21792179
languageName: node
21802180
linkType: hard
21812181

@@ -10147,27 +10147,27 @@ __metadata:
1014710147
languageName: node
1014810148
linkType: hard
1014910149

10150-
"playwright-core@npm:1.47.1":
10151-
version: 1.47.1
10152-
resolution: "playwright-core@npm:1.47.1"
10150+
"playwright-core@npm:1.48.0":
10151+
version: 1.48.0
10152+
resolution: "playwright-core@npm:1.48.0"
1015310153
bin:
1015410154
playwright-core: cli.js
10155-
checksum: 10/b5ee08e1a934237fca0f0f52a677e5d49e45578e14b48a886927428bdf453f355a120548ae2f3f97e28a9d5e23a213120f6d8f10e18ee3f9112b10716888dac4
10155+
checksum: 10/644489b4de9cc181e83eb639a283d3c4f8e4c3b1b1759d7c93b72fd0373b5a66ba376ee6a5ee3eca67f1b773bf15c5e01b6aeedd43c94c355bf4fc0d110713bc
1015610156
languageName: node
1015710157
linkType: hard
1015810158

10159-
"playwright@npm:1.47.1":
10160-
version: 1.47.1
10161-
resolution: "playwright@npm:1.47.1"
10159+
"playwright@npm:1.48.0":
10160+
version: 1.48.0
10161+
resolution: "playwright@npm:1.48.0"
1016210162
dependencies:
1016310163
fsevents: "npm:2.3.2"
10164-
playwright-core: "npm:1.47.1"
10164+
playwright-core: "npm:1.48.0"
1016510165
dependenciesMeta:
1016610166
fsevents:
1016710167
optional: true
1016810168
bin:
1016910169
playwright: cli.js
10170-
checksum: 10/f4340f28485bd83a856a365a03af2013b3203c8134a075d05f1a834665e1204b98141c335d5c5c1600720c9e07db702db3dbff5ef138fc1c31d5feec3ac0057f
10170+
checksum: 10/85b06ae8d0ab7a5a8c9a0d416007b18f35a59455fad40438bda98cbe07c48f338e97b98b1d9214e27f08d6ac284eba0eaab722f5684cd17dd4a47f5b69d004b9
1017110171
languageName: node
1017210172
linkType: hard
1017310173

@@ -10447,7 +10447,7 @@ __metadata:
1044710447
"@grafana/schema": "npm:11.2.0"
1044810448
"@grafana/tsconfig": "npm:^1.2.0-rc1"
1044910449
"@grafana/ui": "npm:11.2.0"
10450-
"@playwright/test": "npm:^1.47.1"
10450+
"@playwright/test": "npm:^1.48.0"
1045110451
"@react-hook/resize-observer": "npm:^1.2.6"
1045210452
"@swc/core": "npm:^1.3.51"
1045310453
"@swc/helpers": "npm:^0.5.0"

0 commit comments

Comments
 (0)