Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit c5e1c37

Browse files
committed
chore(table): added thead line for scrolling, reverted table contraint treatment
1 parent f59be6e commit c5e1c37

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

dist/table/table.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.table {
2-
max-height: 90vh;
32
overflow-x: auto;
43
position: relative;
54
-webkit-overflow-scrolling: touch;
@@ -30,7 +29,7 @@
3029
}
3130

3231
.table table {
33-
border-collapse: collapse;
32+
border-collapse: initial;
3433
border-spacing: 0;
3534
width: 100%;
3635
}
@@ -85,6 +84,10 @@
8584
max-height: unset;
8685
}
8786

87+
.table--constrained-height {
88+
max-height: 90vh;
89+
}
90+
8891
.table th a,
8992
.table th button {
9093
align-items: center;

src/modules/table.marko

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,17 +1242,14 @@ import tableLandscapePic from "/src/routes/static/img/tb-landscape-pic.jpg";
12421242
</div>
12431243
</highlight-code>
12441244

1245-
<h3>Full Height Table</h3>
1245+
<h3>Table with Constrained Height</h3>
12461246
<p>
1247-
By default a table takes up only a portion of the viewport height to allow for easier scrolling, especially on smaller screens where a table could potentially take up the entire screen and force users to scroll the table before being able to scroll the page body. Also, with a preferred number of rows adjustable by the user, the table could grow in height and make it even more difficult for users to navigate and explore the page. The default experience is highly recommended.
1248-
</p>
1249-
<p>
1250-
However, in the rare instance an exception is needed, you can make tables full height by adding the <span class="highlight">table--full-height</span> modifier class to module. That will display the full table without any max-height restrictons.
1247+
You may constrain the height of the table, which will constrain the table to a percentage of the viewport height as opposed to allowing the full table contents to be fully visible. This is typically used in a table with a frozen header. To do so, add a <span class="highlight">table--constrained-height</span> modifier class to module.
12511248
</p>
12521249

12531250
<div class="demo">
12541251
<div class="demo__inner">
1255-
<div class="table table--frozen-header table--full-height" role="group" aria-label="Video games for sale" tabindex="0">
1252+
<div class="table table--frozen-header table--constrained-height" role="group" aria-label="Video games for sale" tabindex="0">
12561253
<table>
12571254
<thead>
12581255
<tr>
@@ -1443,7 +1440,7 @@ import tableLandscapePic from "/src/routes/static/img/tb-landscape-pic.jpg";
14431440
</div>
14441441

14451442
<highlight-code type="html">
1446-
<div class="table table--frozen-header table--full-height" role="group" aria-label="Video games for sale" tabindex="0">
1443+
<div class="table table--frozen-header table--constrained-height" role="group" aria-label="Video games for sale" tabindex="0">
14471444
<table>
14481445
<thead>
14491446
<tr>

src/sass/table/table.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ $density-default-img-radius: 8px;
2222
$density-relaxed-img-radius: 8px;
2323

2424
.table {
25-
max-height: 90vh;
2625
overflow-x: auto;
2726
position: relative;
2827
}
2928

3029
@include scrollbars-permanent(".table");
3130

3231
.table table {
33-
border-collapse: collapse;
32+
border-collapse: separate;
3433
border-spacing: 0;
3534
width: 100%;
3635
}
@@ -96,6 +95,10 @@ $density-relaxed-img-radius: 8px;
9695
max-height: unset;
9796
}
9897

98+
.table--constrained-height {
99+
max-height: 90vh;
100+
}
101+
99102
.table th button,
100103
.table th a {
101104
align-items: center;

0 commit comments

Comments
 (0)