Skip to content

Commit 2923e86

Browse files
authored
fix: Header row in View table disappears when scrolling up (#3105)
1 parent a0dd3d1 commit 2923e86

File tree

4 files changed

+76
-60
lines changed

4 files changed

+76
-60
lines changed

src/dashboard/Data/Views/Views.react.js

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,24 @@ class Views extends TableView {
356356
return (
357357
<div>
358358
<LoaderContainer loading={loading} solid={false}>
359-
<div className={tableStyles.content} style={{ overflowX: 'auto', paddingTop: 96 }}>
360-
<div style={{ width: this.state.tableWidth }}>
359+
<div style={{
360+
position: 'fixed',
361+
top: 96,
362+
left: 300,
363+
right: 0,
364+
bottom: 0,
365+
overflow: 'auto'
366+
}}>
367+
<div style={{ minWidth: this.state.tableWidth }}>
361368
<div
362369
className={tableStyles.headers}
363370
style={{
364-
width: this.state.tableWidth,
365-
right: 'auto',
366371
position: 'sticky',
367372
top: 0,
368373
left: 0,
374+
right: 0,
375+
zIndex: 10,
376+
background: '#66637A',
369377
}}
370378
ref={this.headersRef}
371379
>
@@ -602,31 +610,30 @@ class Views extends TableView {
602610

603611
return (
604612
<div key={name} className={styles.headerWrap} style={{ width }}>
605-
<span className={styles.headerText}>
606-
<span className={styles.headerLabel}>{name}</span>
607-
{isPointerColumn && (
608-
<button
609-
type="button"
610-
className={styles.pointerIcon}
611-
onClick={(e) => {
612-
e.stopPropagation();
613-
e.preventDefault();
614-
this.handleOpenAllPointers(name);
615-
// Remove focus after action to follow UX best practices
616-
e.currentTarget.blur();
617-
}}
618-
aria-label={`Filter to show all pointers from ${name} column`}
619-
title="Filter to show all pointers from this column"
620-
>
621-
<Icon
622-
name="right-outline"
623-
width={20}
624-
height={20}
625-
fill="white"
626-
/>
627-
</button>
628-
)}
629-
</span>
613+
<div className={styles.headerName}>{name}</div>
614+
<div className={styles.headerType}>{columnType || 'String'}</div>
615+
{isPointerColumn && (
616+
<button
617+
type="button"
618+
className={styles.pointerIcon}
619+
onClick={(e) => {
620+
e.stopPropagation();
621+
e.preventDefault();
622+
this.handleOpenAllPointers(name);
623+
// Remove focus after action to follow UX best practices
624+
e.currentTarget.blur();
625+
}}
626+
aria-label={`Filter to show all pointers from ${name} column`}
627+
title="Filter to show all pointers from this column"
628+
>
629+
<Icon
630+
name="right-outline"
631+
width={20}
632+
height={20}
633+
fill="white"
634+
/>
635+
</button>
636+
)}
630637
<DragHandle className={styles.handle} onDrag={delta => this.handleResize(i, delta)} />
631638
</div>
632639
);

src/dashboard/Data/Views/Views.scss

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,44 @@
55
}
66

77
.headerWrap {
8+
@include MonospaceFont;
89
display: inline-block;
910
vertical-align: top;
1011
background: #66637A;
1112
color: white;
12-
line-height: 30px;
13-
padding: 0 16px;
13+
font-size: 12px;
14+
height: 30px;
15+
padding: 4px 16px;
1416
border-right: 1px solid #e3e3ea;
1517
position: relative;
1618
white-space: nowrap;
1719
overflow: hidden;
1820
text-overflow: ellipsis;
21+
22+
&:has(.pointerIcon) {
23+
padding-right: 46px;
24+
}
1925
}
2026

21-
.headerText {
22-
display: flex;
23-
align-items: center;
24-
justify-content: space-between;
25-
width: 100%;
26-
min-width: 0; // Enable text truncation in flex containers
27+
.headerName {
28+
color: white;
29+
font-size: 12px;
30+
height: 22px;
31+
line-height: 22px;
32+
margin-right: 8px;
33+
float: left;
34+
max-width: 100%;
35+
overflow: hidden;
36+
text-overflow: ellipsis;
2737
}
2838

29-
.headerLabel {
39+
.headerType {
40+
color: #A2A6B1;
41+
font-size: 10px;
42+
height: 22px;
43+
line-height: 22px;
3044
overflow: hidden;
3145
text-overflow: ellipsis;
32-
white-space: nowrap;
33-
flex: 1;
34-
min-width: 0; // Enable text truncation
3546
}
3647

3748
.pointerIcon {
@@ -41,31 +52,32 @@
4152
font: inherit;
4253
color: inherit;
4354
background: rgba(255, 255, 255, 0.2);
44-
55+
4556
// Custom styles
4657
cursor: pointer;
4758
opacity: 0.7;
4859
transition: opacity 0.2s ease;
4960
z-index: 10;
5061
pointer-events: auto;
51-
display: inline-flex;
62+
display: flex;
5263
align-items: center;
5364
justify-content: center;
5465
height: 20px;
5566
width: 20px;
5667
border-radius: 50%;
57-
margin-left: 5px;
58-
flex-shrink: 0;
59-
68+
position: absolute;
69+
right: 15px;
70+
top: 5px;
71+
6072
& svg {
6173
transform: rotate(316deg);
6274
}
63-
75+
6476
&:hover {
6577
opacity: 1;
6678
background: rgba(255, 255, 255, 0.3);
6779
}
68-
80+
6981
&:focus {
7082
opacity: 1;
7183
background: rgba(255, 255, 255, 0.4);

src/dashboard/TableView.react.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default class TableView extends DashboardView {
3838
if (data.length === 0) {
3939
content = <div className={styles.empty}>{this.renderEmpty()}</div>;
4040
} else {
41+
headers = this.renderHeaders();
4142
content = (
4243
<div className={styles.rows}>
4344
<table>
@@ -46,7 +47,6 @@ export default class TableView extends DashboardView {
4647
{footer}
4748
</div>
4849
);
49-
headers = this.renderHeaders();
5050
}
5151
}
5252
}
@@ -55,10 +55,12 @@ export default class TableView extends DashboardView {
5555
return (
5656
<div>
5757
<LoaderContainer loading={loading}>
58-
<div className={styles.content}>{content}</div>
58+
<div className={styles.content}>
59+
<div className={styles.headers}>{headers}</div>
60+
{content}
61+
</div>
5962
</LoaderContainer>
6063
{toolbar}
61-
<div className={styles.headers}>{headers}</div>
6264
{extras}
6365
</div>
6466
);

src/dashboard/TableView.scss

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,19 @@
88
@import 'stylesheets/globals.scss';
99

1010
.headers {
11-
position: fixed;
11+
position: sticky;
1212
top: 96px;
13-
left: 300px;
13+
left: 0;
1414
right: 0;
1515
background: #66637A;
1616
height: 30px;
1717
white-space: nowrap;
18-
}
19-
20-
body:global(.expanded) {
21-
.headers {
22-
left: $sidebarCollapsedWidth;
23-
}
18+
z-index: 10;
2419
}
2520

2621
.content {
2722
position: relative;
28-
padding-top: 126px;
23+
padding-top: 96px;
2924
min-height: 100vh;
3025
}
3126

0 commit comments

Comments
 (0)