Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix - Inconsistent table border width size on zoom and extra spaces between table cells #1130

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
106 changes: 51 additions & 55 deletions lib/css/components/tables.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// - Totals row
// - Sortable tables
// • TABLE CELL SIZES
// • TABLE BORDER WITH SIZES ON ZOOM
//

// ============================================================================
Expand All @@ -41,13 +42,11 @@
border-collapse: collapse;
border-spacing: 0;
font-size: var(--fs-body1);

border: 0.01px solid var(--bc-medium); // Using 0.01 is workaround for border-with calculation, because the Browser will fallback to at least 1px
th,
td {
padding: var(--su8);
border-top: 1px solid var(--bc-medium);
border-left: 1px solid var(--bc-medium);
border-right: 1px solid var(--bc-medium);
border-left: 0.01px solid var(--bc-medium);
vertical-align: middle;
color: var(--fc-medium);
text-align: left;
Expand All @@ -66,6 +65,11 @@
color: var(--fc-dark);
}

tr {
border-bottom: 0.01px solid var(--bc-medium);
position: initial;
}

// Custom styles when in a table head
thead th {
vertical-align: bottom;
Expand All @@ -78,17 +82,6 @@
tbody th {
font-weight: normal;
}

// If it's the last row, add a bottom border
tr:last-of-type td,
tr:last-of-type th {
border-bottom: 1px solid var(--bc-medium);
}

// If two table bodies are next to each other, visually separate them
tbody + tbody {
border-top: var(--su-static2) solid var(--bc-medium);
}
}

// ============================================================================
Expand Down Expand Up @@ -196,71 +189,49 @@
// ------------------------------------------------------------------------
// -- No Borders
&.s-table__b0 {
th,
border: 0;
tr,
td,
tr:last-of-type th,
tr:last-of-type td {
border-color: transparent;
th {
border: none
}

// Clear Header Styles
thead th {
background-color: transparent;
text-transform: initial;
font-size: inherit;
letter-spacing: initial;
}

// This makes the border transparent, so we need to use whitespace
// to achieve the same effect a 2px gray border achieves.
tbody + tbody {
border-color: transparent;
border-width: var(--su-static12);
}
}

// -- Horizontal Only with Table Outline
&.s-table__bx {
tr {
> *:not(:first-child) {
border-left-color: transparent;
}
> *:not(:last-child) {
border-right-color: transparent;
}
th,
td {
border-left: none
}
}

// -- Horizontal Only without Table Outline
&.s-table__bx-simple {
border: 0;
tr {
&:last-of-type {
border-bottom: 0;
}
}
th,
td {
border-left-color: transparent;
border-right-color: transparent;
border: none;
}
thead th {
border-top-color: transparent;
border-bottom-color: var(--bc-darker);
border-bottom: 0.01px solid var(--bc-darker);
// Clear Header Styles
background-color: transparent;
text-transform: initial;
font-size: inherit;
letter-spacing: initial;
}
tbody tr {
&:first-of-type th,
&:first-of-type td {
border-top-color: transparent;
}
&:last-of-type th,
&:last-of-type td {
border-bottom-color: transparent;
}
}
tfoot th,
tfoot td {
border-bottom-color: transparent;
}
}

// $$ TOTALS ROW
Expand Down Expand Up @@ -294,24 +265,28 @@
// $$ Progress Bar
// ------------------------------------------------------------------------
td.s-table--progress {
border-right: none;
text-align: right;
}

td.s-table--progress-bar {
border-left: none;
padding-left: 0;
width: 120px;
box-shadow: none;
}

// $$ Disabled rows
// ------------------------------------------------------------------------
tr.is-disabled {
background-color: var(--black-025);
th,
td {
background-color: var(--black-025);

}

th:not(.is-enabled),
td:not(.is-enabled) {
opacity: calc(var(--_o-disabled) * 0.6); // 0.5 * 0.6 = 0.3
color: var(--black-150);
}
}
}
Expand All @@ -335,3 +310,24 @@
.s-table--cell10 { width: @table-columns * 10; }
.s-table--cell11 { width: @table-columns * 11; }
.s-table--cell12 { width: @table-columns * 12; }

// ============================================================================
// $ TABLE BORDER WITH SIZES ON ZOOM
// ============================================================================
@media (min-resolution: 120dpi) {
table, th, td {
border-width: 0.75px;
}
}

@media (min-resolution: 144dpi) {
table, th, td {
border-width: 0.666px;
}
}

@media (min-resolution: 192dpi) {
table, th, td {
border-width: 0.5px;
}
}