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

Inconsistant .table-active color #24529

Closed
gillerr opened this issue Oct 24, 2017 · 7 comments · Fixed by #30466
Closed

Inconsistant .table-active color #24529

gillerr opened this issue Oct 24, 2017 · 7 comments · Fixed by #30466

Comments

@gillerr
Copy link

gillerr commented Oct 24, 2017

According to your documentation at http://getbootstrap.com/docs/4.0/content/tables/, table-active class can be applied to either tr's, td's or th's. But the resulting background color will be different, with a darker color for tr's.
This could be seen in the following plunker:
http://plnkr.co/edit/aYMqCL0dKLPq9vPdDpWH?p=preview

The reason is that table-active is defined with an opacity and is applied to both the trand its td's / th's.

To fix that, instead of this selector:

.table-active, .table-active>td, .table-active>th

I would simply use:

.table-active

Another solution would be to use #ECECEC instead of rgba(0,0,0,.075).

@andresgalante
Copy link
Collaborator

Hi @gillerr Thanks for reporting this.

@mdo There is a comment on the table variant mixin mentioning the reason why we use >td, >th selectors here:
https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_table-row.scss#L8-L9

But it's not only causing the problems described on this issue but also avoids having an active cell inside a colored row, like this:
screen shot 2017-10-24 at 9 03 21 am

For now I'll add this comment, it'd be awesome if anyone wants to tackle this one. if not I'll probably have time to jump into it this week

@andresgalante
Copy link
Collaborator

One more note about table-active: it's almost invisible when the table is table-dark

@andresgalante
Copy link
Collaborator

@mdo I am sure I am missing something, I tried to track down the history of why we use the table-row-variant for active tables but I got lost.

Why can't we use something like this:

.table-active { background-color: $table-active-bg; }

.table-dark {
  &.table-active,
  .table-active {
    background-color: $table-dark-active-bg;
  }
}

@gijsbotje Can you help me out?

@tpinne
Copy link

tpinne commented Jul 2, 2018

The same problem exist with any contextual class if it has an opacity. For example if one defines some color variables with opacity. This gets even more interesting in combination with a striped table as you can see in this Plunkr http://next.plnkr.co/edit/y6FAFciwWTdbdsmK

Expected result would be that all elements with the table-danger class would have the same background color. But depending on the combination of tr-class, td-class and striped table there are numerous variations because of the layered transparent colors.

bildschirmfoto 2018-07-02 um 11 12 52

@mdo
Copy link
Member

mdo commented Mar 6, 2020

This will be resolved by #30342.

@mdo
Copy link
Member

mdo commented Apr 9, 2020

@MartijnCuppens Will your tables PR cover this one as well?

@MartijnCuppens
Copy link
Member

Yup, in #30466 active is a state, not a table color variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment