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

Expected style "zIndex: 1px" to be unitless #660

Open
wu0407 opened this issue Feb 16, 2025 · 1 comment
Open

Expected style "zIndex: 1px" to be unitless #660

wu0407 opened this issue Feb 16, 2025 · 1 comment

Comments

@wu0407
Copy link

wu0407 commented Feb 16, 2025

Bug report

Description / Observed Behavior

The Zindex in style has no unit, but the warning in the console is "Expected style "zIndex: 1px" to be unitless".
I try to set Zindex as int or string, it has the same result in the console under debug mode.

Expected Behavior

no warning

Reproduction

<div
      style={{
        display: "flex",
        flexDirection: "column",
        alignItems: "center",
        justifyContent: "center",
        // gap: "32px",
        padding: "20px 30px",
        width: "1349.5px",
        height: "390px",
        position: "relative",
        zIndex: 1,
        overflow: "hidden",
      }}
    >

Additional Context

satori: 0.20.0
nextjs: 15.1.2

@erxclau
Copy link
Contributor

erxclau commented Feb 23, 2025

There was a similar issue regarding line height here: #535. Satori lists out CSS properties that should opt out of pixel units:

const optOutPx = new Set([
'flex',
'flexGrow',
'flexShrink',
'flexBasis',
'fontWeight',
'lineHeight',
'opacity',
'scale',
'scaleX',
'scaleY',
])

In theory, we could add zIndex to that list.

That said, setting a z-index has no effect because it is not supported in SVG, as mentioned in the README:

There is no z-index support in SVG. Elements that come later in the document will be painted on top.

The warning is a bit of a red herring since setting z-index doesn't do anything.

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

No branches or pull requests

2 participants