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

Inputs.table header opacity glitch when using custom format #234

Open
oluckyman opened this issue Jul 26, 2022 · 4 comments
Open

Inputs.table header opacity glitch when using custom format #234

oluckyman opened this issue Jul 26, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@oluckyman
Copy link
Contributor

oluckyman commented Jul 26, 2022

When I use custom format with HTML that have opacity, the cell content appears above the table header.
See example notebook:

SS 2022-07-26 at 5 22 19 PM

It's not a big deal for prototyping and exploring. But I love Inptuts.table and am using it a lot, including for presenting to users custom tables like this
image

@mbostock
Copy link
Member

We could fix this by adding a z-index: 1; here:

inputs/src/style.css

Lines 274 to 279 in 3281a4a

.__ns__-table thead th {
position: sticky;
top: 0;
background: white;
cursor: ns-resize;
}

@oluckyman
Copy link
Contributor Author

Thank you for the quick response!

I am curious is it a known browser bug? Don't understand why normal content renders just fine and the semi-transparent content appears above 🤔

@mbostock
Copy link
Member

@oluckyman Here’s a result I found on stacking contexts if you want to learn about this behavior: https://www.oreilly.com/library/view/developing-web-components/9781491905685/ch04.html

@oluckyman
Copy link
Contributor Author

Thanks Mike, it was helpful! 🙌

If someone curious too, this peace was missing in my mental model:

A stacking context is created when an element is positioned and assigned a z-index value other than auto, or when an element has an opacity value less than 1

So by setting opacity to the cell of the table I made it compete with the stacking context of the header, which has position: sticky.

Knowing this I fixed the glitch by setting position: relative; z-index: -1 to my custom HTML in table cells.

Added the workaround to the notebook:
image

@mbostock mbostock added the bug Something isn't working label Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants