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

fix(table): Add border color relative to theme for accessibility #25755

Merged
merged 3 commits into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scss/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
// inheritance to nested tables.

@each $color, $value in $theme-colors {
@include table-row-variant($color, theme-color-level($color, -9));
@include table-row-variant($color, theme-color-level($color, $table-bg-level), theme-color-level($color, $table-border-level));
}

@include table-row-variant(active, $table-active-bg);
Expand Down
3 changes: 3 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ $table-striped-order: odd !default;

$table-caption-color: $text-muted !default;

$table-bg-level: -9 !default;
$table-border-level: -6 !default;


// Buttons + Forms
//
Expand Down
11 changes: 10 additions & 1 deletion scss/mixins/_table-row.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Tables

@mixin table-row-variant($state, $background) {
@mixin table-row-variant($state, $background, $border: null) {
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
.table-#{$state} {
Expand All @@ -9,6 +9,15 @@
> td {
background-color: $background;
}

@if $border != null {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wrap this around a null conditional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because $border is initialized to null above. And this way it's an optional parameter.

th,
td,
thead th,
tbody + tbody {
border-color: $border;
}
}
}

// Hover states for `.table-hover`
Expand Down