generic form table scroll lock for headers

This commit is contained in:
ValueOn AG 2026-01-21 16:30:22 +01:00
parent d3873223f5
commit 34d4646667
3 changed files with 36 additions and 34 deletions

View file

@ -4,10 +4,10 @@
gap: 10px; gap: 10px;
width: 100%; width: 100%;
font-family: var(--font-family); font-family: var(--font-family);
/* Ensure proper height constraints for scrolling */ /* Fill available space and constrain height */
min-height: 0; min-height: 0;
flex: 1; flex: 1;
overflow: hidden; /* No overflow - children handle their own scrolling */
} }
.title { .title {
@ -18,25 +18,18 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
/* Table Container - flipped to show horizontal scrollbar at top */ /* Table Container - scrollable area for table data only */
.tableContainer { .tableContainer {
position: relative; position: relative;
overflow: auto; overflow: auto;
border: 1px solid var(--color-primary); border: 1px solid var(--color-primary);
border-radius: 25px; border-radius: 25px;
background: var(--color-bg); background: var(--color-bg);
/* Fill available space in flex container */ /* Fill remaining space after controls */
flex: 1; flex: 1;
min-height: 0; min-height: 0;
/* Ensure scrolling within container */ /* Clip content to border-radius but allow sticky to work */
max-height: 100%; isolation: isolate;
/* Flip container to move horizontal scrollbar to top */
transform: scaleY(-1);
}
/* Flip table content back to normal orientation */
.tableContainer > * {
transform: scaleY(-1);
} }
/* Empty table styling - no extra space, just header */ /* Empty table styling - no extra space, just header */
@ -77,7 +70,9 @@
/* Table Styles */ /* Table Styles */
.table { .table {
width: 100%; width: 100%;
border-collapse: collapse; /* Use separate borders for sticky header support */
border-collapse: separate;
border-spacing: 0;
font-size: 14px; font-size: 14px;
background: var(--color-bg); background: var(--color-bg);
table-layout: fixed; table-layout: fixed;
@ -104,10 +99,20 @@
background-color: rgba(255, 255, 255, 0.05) !important; background-color: rgba(255, 255, 255, 0.05) !important;
} }
.th { /* Sticky thead for table header */
.table thead {
position: sticky; position: sticky;
/* Due to scaleY(-1) transform on container, bottom: 0 acts as top: 0 */ top: 0;
bottom: 0; z-index: 10;
/* Shadow to separate header from scrolled content */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.table thead tr {
background: var(--color-bg);
}
.th {
background: var(--color-bg); background: var(--color-bg);
padding: 10px 16px; padding: 10px 16px;
text-align: left; text-align: left;
@ -118,10 +123,10 @@
overflow-wrap: break-word; overflow-wrap: break-word;
word-break: break-word; word-break: break-word;
user-select: none; user-select: none;
z-index: 10;
overflow: visible; overflow: visible;
/* Add shadow to visually separate from scrolled content */ /* Border separates header from scrolled content */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); border-bottom: 2px solid var(--color-primary);
/* Shadow on the row, not individual cells */
} }
.th.actionsColumn { .th.actionsColumn {
@ -339,11 +344,9 @@
position: relative; position: relative;
} }
/* Selection column header sticky */ /* Selection column header - background inherited from thead */
thead .selectColumn { thead .selectColumn {
position: sticky; background: var(--color-bg);
bottom: 0;
z-index: 10;
} }
/* Selection Column border only on body cells, not header */ /* Selection Column border only on body cells, not header */
@ -394,11 +397,9 @@ tbody .selectColumn {
position: relative; position: relative;
} }
/* Actions column header sticky */ /* Actions column header - background inherited from thead */
thead .actionsColumn { thead .actionsColumn {
position: sticky; background: var(--color-bg);
bottom: 0;
z-index: 10;
} }
/* Actions Column border only on body cells, not header */ /* Actions Column border only on body cells, not header */

View file

@ -19,7 +19,7 @@
height: 100%; height: 100%;
background: var(--surface-color, #f8f9fa); background: var(--surface-color, #f8f9fa);
border-right: 1px solid var(--border-color, #e0e0e0); border-right: 1px solid var(--border-color, #e0e0e0);
overflow: hidden; overflow: visible;
} }
/* Logo */ /* Logo */
@ -81,8 +81,10 @@
/* Content */ /* Content */
.content { .content {
flex: 1; flex: 1;
overflow: auto; overflow: hidden;
background: var(--bg-primary, #ffffff); background: var(--bg-primary, #ffffff);
display: flex;
flex-direction: column;
} }
/* Dark Theme */ /* Dark Theme */

View file

@ -144,10 +144,9 @@
.tableContainer { .tableContainer {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: auto; overflow: hidden;
background: var(--surface-color); display: flex;
border: 1px solid var(--border-color); flex-direction: column;
border-radius: 8px;
} }
.loadingContainer { .loadingContainer {