Skip to content

Commit f783196

Browse files
fix(table): correct SR table headings, adjust spacing
1 parent dca9bd0 commit f783196

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

packages/sage-assets/lib/stylesheets/components/_table.scss

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ $-table-overflow-indicator-gradient: linear-gradient(
3838
// Responsive stacked table
3939
$-table-stack-row-padding-block: rem(18px);
4040
$-table-stack-row-padding-inline: rem(20px);
41+
$-table-stack-row-margin-block: rem(15); // UXD TODO: confirm size with design
4142
$-table-stack-cell-max-children: 4;
4243

4344
// Other
@@ -359,6 +360,10 @@ $-table-avatar-width: rem(32px);
359360
}
360361

361362
@media screen and (max-width: sage-breakpoint(sm-max)) {
363+
.sage-table-wrapper__overflow--stack::after {
364+
opacity: 0;
365+
}
366+
362367
.sage-table--stack {
363368
thead tr {
364369
@include visually-hidden;
@@ -376,13 +381,10 @@ $-table-avatar-width: rem(32px);
376381

377382
tbody tr {
378383
padding: #{$-table-stack-row-padding-block} #{$-table-stack-row-padding-inline};
384+
margin-bottom: #{$-table-stack-row-margin-block};
379385
position: relative;
380386
border: sage-border(default);
381387
border-radius: sage-border(radius);
382-
383-
& + & {
384-
margin-top: #{$-table-stack-row-padding-block};
385-
}
386388
}
387389

388390
tbody td {
@@ -411,20 +413,8 @@ $-table-avatar-width: rem(32px);
411413
}
412414

413415
.sage-table-cell--avatar,
414-
.sage-table--has-menu-options td:last-child::before {
416+
&.sage-table--has-menu-options td:last-child::before {
415417
display: none;
416418
}
417419
}
418420
}
419-
420-
@media screen and (min-width: sage-breakpoint(md-min)) {
421-
.sage-table td::before {
422-
display: none;
423-
}
424-
425-
.sage-table--has-leading-input {
426-
tbody td:first-child {
427-
width: rem(44px);
428-
}
429-
}
430-
}

packages/sage-system/lib/table.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ Sage.table = (function() {
4949
tables.forEach(table => {
5050
const headers = table.querySelectorAll('.sage-table__header');
5151
const rows = table.querySelectorAll('tbody tr');
52+
const tableWrapper = table.parentElement;
5253
const tableHeadings = [];
5354

55+
tableWrapper.classList.add("sage-table-wrapper__overflow--stack");
56+
5457
// populate an array with each table's headers
5558
headers.forEach(header => {
5659
const label = header.textContent.trim();
@@ -102,6 +105,7 @@ Sage.table = (function() {
102105

103106
function addTableAria() {
104107
const tableItems = [
108+
{ items: 'thead th', role: 'columnheader' },
105109
{ items: 'tbody', role: 'rowgroup' },
106110
{ items: 'tbody tr', role: 'row' },
107111
{ items: 'tbody td', role: 'cell' },

0 commit comments

Comments
 (0)