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 - tr background color for table-active when used with table-striped #33913

Closed
tnguyen14 opened this issue May 9, 2021 · 5 comments · Fixed by #37084
Closed

Bug - tr background color for table-active when used with table-striped #33913

tnguyen14 opened this issue May 9, 2021 · 5 comments · Fixed by #37084

Comments

@tnguyen14
Copy link

In version 5.0.0, the table-active class, when applied to a tr, is superseded by a table-striped class on the table.
As can be seen in the codepen below, the first row background color is still var(--bs-table-striped-bg), instead of var(--bs-table-active-bg)
The same is not happening when table-active class is applied to a td.

This issue is not present in version 4.6.0.

@ffoodd
Copy link
Member

ffoodd commented May 13, 2021

Probably fixed by #33825, need to check.

@tungphan995

This comment has been minimized.

@ffoodd
Copy link
Member

ffoodd commented May 14, 2021

So, just checked and #33825 does not solve this.

I think we'd need some custom cascade here, just like @mirisuzanne explained in a CodePen.

@bavoco
Copy link
Contributor

bavoco commented Aug 22, 2021

Although it's not an elegant solution, this could be solved by increasing the specificity of .table-active.

Changing it to
.table-active.table-active.table-active, .table-active.table-active.table-active > * { ... }

makes it have a higher specificity than the .table-striped selector.

@kant2002
Copy link

kant2002 commented May 3, 2022

I have no idea why so many .table-active so solve that by applying to my customization file.

.table-striped > tbody > tr.table-active:nth-of-type(odd) > * {
    --bs-table-accent-bg: var(--bs-table-active-bg);
}

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

Successfully merging a pull request may close this issue.

6 participants